Learn R Programming

fdasrvf (version 1.9.4)

kmeans_align: K-Means Clustering and Alignment

Description

This function clusters functions and aligns using the elastic square-root slope (srsf) framework.

Usage

kmeans_align(
  f,
  time,
  K,
  seeds = NULL,
  lambda = 0,
  showplot = TRUE,
  smooth_data = FALSE,
  sparam = 25,
  parallel = FALSE,
  alignment = TRUE,
  omethod = "DP",
  MaxItr = 50,
  thresh = 0.01
)

Arguments

f

matrix (\(N\) x \(M\)) of \(M\) functions with \(N\) samples

time

vector of size \(N\) describing the sample points

K

number of clusters

seeds

indexes of cluster center functions (default = NULL)

lambda

controls the elasticity (default = 0)

showplot

shows plots of functions (default = T)

smooth_data

smooth data using box filter (default = F)

sparam

number of times to apply box filter (default = 25)

parallel

enable parallel mode using foreach and doParallel package (default=F)

alignment

whether to perform alignment (default = T)

omethod

optimization method (DP,DP2,RBFGS)

MaxItr

maximum number of iterations

thresh

cost function threshold

Value

Returns a fdakma object containing

f0

original functions

fn

aligned functions - matrix (\(N\) x \(M\)) of \(M\) functions with \(N\) samples which is a list for each cluster

qn

aligned SRSFs - similar structure to fn

q0

original SRSFs

labels

cluster labels

templates

cluster center functions

templates.q

cluster center SRSFs

gam

warping functions - similar structure to fn

qun

Cost Function Value

References

Srivastava, A., Wu, W., Kurtek, S., Klassen, E., Marron, J. S., May 2011. Registration of functional data using fisher-rao metric, arXiv:1103.3817v2 [math.ST].

Tucker, J. D., Wu, W., Srivastava, A., Generative Models for Function Data using Phase and Amplitude Separation, Computational Statistics and Data Analysis (2012), 10.1016/j.csda.2012.12.001.

Sangalli, L. M., et al. (2010). "k-mean alignment for curve clustering." Computational Statistics & Data Analysis 54(5): 1219-1233.

Examples

Run this code
# NOT RUN {
data("growth_vel")
out <- kmeans_align(growth_vel$f,growth_vel$time, K=2)
# }

Run the code above in your browser using DataLab