Function to identify local minima (in 2D output space) of distance matrix (in high-dimensional input space)

Description

sDmatMinima is supposed to identify local minima of distance matrix (resulting from sDmat). The criterion of being local minima is that the distance associated with a hexagon/rectangle is always smaller than its direct neighbors (i.e., 1-neighborhood)

Usage

sDmatMinima(sMap, which_neigh = 1, distMeasure = c("median", "mean", "min", "max"))

Arguments

sMap
an object of class "sMap"
which_neigh
which neighbors in 2D output space are used for the calculation. By default, it sets to "1" for direct neighbors, and "2" for neighbors within neighbors no more than 2, and so on
distMeasure
distance measure used to calculate distances in high-dimensional input space. It can be one of "median", "mean", "min" and "max" measures

Value

  • minima: a vector to store a list of local minima (represented by the indexes of hexogans/rectangles

Note

Do not get confused by "which_neigh" and the criteria of being local minima. Both of them deal with 2D output space. However, "which_neigh" is used to assist in the calculation of distance matrix (so can be 1-neighborhood or more); instead, the criterion of being local minima is only 1-neighborhood in the strictest sense

Examples

# 1) generate an iid normal random matrix of 100x10 data <- matrix( rnorm(100*10,mean=0,sd=1), nrow=100, ncol=10) # 2) get trained using by default setup sMap <- sPipeline(data=data)
Start at 2017-03-27 18:54:54 First, define topology of a map grid (2017-03-27 18:54:54)... Second, initialise the codebook matrix (61 X 10) using 'linear' initialisation, given a topology and input data (2017-03-27 18:54:54)... Third, get training at the rough stage (2017-03-27 18:54:54)... 1 out of 7 (2017-03-27 18:54:54) updated (2017-03-27 18:54:54) 2 out of 7 (2017-03-27 18:54:54) updated (2017-03-27 18:54:54) 3 out of 7 (2017-03-27 18:54:54) updated (2017-03-27 18:54:54) 4 out of 7 (2017-03-27 18:54:54) updated (2017-03-27 18:54:54) 5 out of 7 (2017-03-27 18:54:54) updated (2017-03-27 18:54:54) 6 out of 7 (2017-03-27 18:54:54) updated (2017-03-27 18:54:54) 7 out of 7 (2017-03-27 18:54:54) updated (2017-03-27 18:54:54) Fourth, get training at the finetune stage (2017-03-27 18:54:54)... 1 out of 25 (2017-03-27 18:54:54) updated (2017-03-27 18:54:54) 2 out of 25 (2017-03-27 18:54:54) updated (2017-03-27 18:54:54) 3 out of 25 (2017-03-27 18:54:54) updated (2017-03-27 18:54:54) 4 out of 25 (2017-03-27 18:54:54) updated (2017-03-27 18:54:54) 5 out of 25 (2017-03-27 18:54:54) updated (2017-03-27 18:54:54) 6 out of 25 (2017-03-27 18:54:54) updated (2017-03-27 18:54:54) 7 out of 25 (2017-03-27 18:54:54) updated (2017-03-27 18:54:54) 8 out of 25 (2017-03-27 18:54:54) updated (2017-03-27 18:54:54) 9 out of 25 (2017-03-27 18:54:54) updated (2017-03-27 18:54:54) 10 out of 25 (2017-03-27 18:54:54) updated (2017-03-27 18:54:54) 11 out of 25 (2017-03-27 18:54:54) updated (2017-03-27 18:54:54) 12 out of 25 (2017-03-27 18:54:54) updated (2017-03-27 18:54:54) 13 out of 25 (2017-03-27 18:54:54) updated (2017-03-27 18:54:54) 14 out of 25 (2017-03-27 18:54:54) updated (2017-03-27 18:54:54) 15 out of 25 (2017-03-27 18:54:54) updated (2017-03-27 18:54:54) 16 out of 25 (2017-03-27 18:54:54) updated (2017-03-27 18:54:54) 17 out of 25 (2017-03-27 18:54:54) updated (2017-03-27 18:54:54) 18 out of 25 (2017-03-27 18:54:54) updated (2017-03-27 18:54:54) 19 out of 25 (2017-03-27 18:54:54) updated (2017-03-27 18:54:54) 20 out of 25 (2017-03-27 18:54:54) updated (2017-03-27 18:54:54) 21 out of 25 (2017-03-27 18:54:54) updated (2017-03-27 18:54:54) 22 out of 25 (2017-03-27 18:54:54) updated (2017-03-27 18:54:54) 23 out of 25 (2017-03-27 18:54:54) updated (2017-03-27 18:54:54) 24 out of 25 (2017-03-27 18:54:54) updated (2017-03-27 18:54:54) 25 out of 25 (2017-03-27 18:54:54) updated (2017-03-27 18:54:54) Next, identify the best-matching hexagon/rectangle for the input data (2017-03-27 18:54:54)... Finally, append the response data (hits and mqe) into the sMap object (2017-03-27 18:54:54)... Below are the summaries of the training results: dimension of input data: 100x10 xy-dimension of map grid: xdim=9, ydim=9, r=5 grid lattice: hexa grid shape: suprahex dimension of grid coord: 61x2 initialisation method: linear dimension of codebook matrix: 61x10 mean quantization error: 4.9630432442287 Below are the details of trainology: training algorithm: batch alpha type: invert training neighborhood kernel: gaussian trainlength (x input data length): 7 at rough stage; 25 at finetune stage radius (at rough stage): from 3 to 1 radius (at finetune stage): from 1 to 1 End at 2017-03-27 18:54:54 Runtime in total is: 0 secs
# 3) identify local minima of distance matrix based on "median" distances and direct neighbors minima <- sDmatMinima(sMap=sMap, which_neigh=1, distMeasure="median")

Source code

sDmatMinima.r

Source man

sDmatMinima.Rd sDmatMinima.pdf

See also

sDmat, sNeighAny