Last data update: 2014.03.03

R: State initialization for iterative algorithms (randomly or...
initialize_statesR Documentation

State initialization for iterative algorithms (randomly or variants of kmeans)

Description

Initializes the state/cluster assignment either uniformly at random from K classes, or using initial kmeans++ (kmeanspp) clustering (in several variations on PLCs and/or FLCs).

Usage

initialize_states(num.states = NULL, num.samples = NULL, method = c("random", 
    "KmeansPLC", "KmeansFLC", "KmeansPLCFLC", "KmeansFLCPLC"), LCs = list(PLC = NULL, 
    FLC = NULL))

Arguments

num.states

number of states

num.samples

number of samples.

method

how to choose the labels: either uniformly at random from lbrace 1, …, K brace or using K-means on PLCs and FLCs or a combination. Default: method = "random". Other options are c("KmeansPLC","KmeansFLC","KmeansPLCFLC","KmeansFLCPLC")

LCs

(optional) a list of PLC (N \times n_p array) and FLC (N \times n_f array)

Examples

x1 <- rnorm(1000)
x2 <- rnorm(200, mean = 2)
yy <- c(x1, x2)
ss <- initialize_states(num.states = 2, num.samples = length(yy), method = "KmeansFLC", 
    LCs = list(FLCs = yy))
plot(yy, col = ss, pch = 19)
points(x1, col = "blue")

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(LICORS)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/LICORS/initialize_states.Rd_%03d_medium.png", width=480, height=480)
> ### Name: initialize_states
> ### Title: State initialization for iterative algorithms (randomly or
> ###   variants of kmeans)
> ### Aliases: initialize_states
> ### Keywords: datagen distribution multivariate
> 
> ### ** Examples
> 
> x1 <- rnorm(1000)
> x2 <- rnorm(200, mean = 2)
> yy <- c(x1, x2)
> ss <- initialize_states(num.states = 2, num.samples = length(yy), method = "KmeansFLC", 
+     LCs = list(FLCs = yy))
> plot(yy, col = ss, pch = 19)
> points(x1, col = "blue")
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>