Learn R Programming

LICORS (version 0.2.0)

initialize_states: 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, \ldots, K \rbrace\) 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

Run this code
# NOT RUN {
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")
# }

Run the code above in your browser using DataLab