SOM Toolbox Online documentation http://www.cis.hut.fi/projects/somtoolbox/

# som_hits

### Purpose

``` Calculate the response of the given data on the map.

```

### Syntax

```  hits = som_hits(sMap, sData)
hits = som_hits(M, D)
hits = som_hits(..., mode)

```

### Description

``` Returns a vector indicating the response of the map to the data.
The response of the data on the map can be calculated e.g. in
three ways, selected with the mode argument:
'crisp'    traditional hit histogram: how many times each map unit
was the BMU for the data set
'kernel'   a sum of neighborhood kernels, where a kernel
is positioned on the BMU of each data sample. The
neighborhood function is sMap.neigh and the
neighborhood width is sMap.trainhist(end).radius_fin
or 1 if this is not available
'fuzzy'    fuzzy response calculated by summing

1
------------
1 +  (q/a)^2

for each data sample, where q is a vector containing
distance from the data sample to each map unit and
a is average quantization error

```

### Required input arguments

```   sMap              The vectors from among which the BMUs are searched
for. These must not have any unknown components (NaNs).
(struct) map struct
(matrix) codebook matrix, size munits x dim

sData             The data vector(s) for which the BMUs are searched.
(struct) data struct
(matrix) data matrix, size dlen x dim

```

### Optional input arguments

```   mode     (string) The respond mode: 'crisp' (default), 'kernel'
or 'fuzzy'. 'kernel' can only be used if
the first argument (sMap) is a map struct.

```

### Output arguments

```   hits     (vector) The number of hits in each map unit.

```

### Examples

```  hits = som_hits(sM,D);
hits = som_hits(sM,D,'kernel');
hits = som_hits(sM,D,'fuzzy');

```