sInitial: Function to initialise a sInit object given a topology and...

Description Usage Arguments Value Note See Also Examples

View source: R/sInitial.r

Description

sInitial is supposed to initialise an object of class "sInit" given a topology and input data. As a matter of fact, it initialises the codebook matrix (in input high-dimensional space). The return object inherits the topology information (i.e., a "sTopol" object from sTopology), along with initialised codebook matrix and method used.

Usage

1
2
sInitial(data, sTopol, init = c("linear", "uniform", "sample"), seed =
825)

Arguments

data

a data frame or matrix of input data

sTopol

an object of class "sTopol" (see sTopology)

init

an initialisation method. It can be one of "uniform", "sample" and "linear" initialisation methods

seed

an integer specifying the seed

Value

an object of class "sInit", a list with following components:

Note

The initialisation methods include:

See Also

sTopology

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# 1) generate an iid normal random matrix of 100x10 
data <- matrix( rnorm(100*10,mean=0,sd=1), nrow=100, ncol=10)

# 2) from this input matrix, determine nHex=5*sqrt(nrow(data))=50, 
# but it returns nHex=61, via "sHexGrid(nHex=50)", to make sure a supra-hexagonal grid
sTopol <- sTopology(data=data, lattice="hexa", shape="suprahex")

# 3) initialise the codebook matrix using different mehtods
# 3a) using "uniform" method
sI_uniform <- sInitial(data=data, sTopol=sTopol, init="uniform")
# 3b) using "sample" method
# sI_sample <- sInitial(data=data, sTopol=sTopol, init="sample") 
# 3c) using "linear" method
# sI_linear <- sInitial(data=data, sTopol=sTopol, init="linear") 

hfang-bristol/supraHex documentation built on May 24, 2021, 3:13 p.m.