kmeans_align {fdasrvf} | R Documentation |
K-Means Clustering and Alignment
Description
This function clusters functions and aligns using the elastic square-root velocity function (SRVF) framework.
Usage
kmeans_align(
f,
time,
K = 1L,
seeds = NULL,
centroid_type = c("mean", "medoid"),
nonempty = 0L,
lambda = 0,
showplot = FALSE,
smooth_data = FALSE,
sparam = 25L,
parallel = FALSE,
alignment = TRUE,
rotation = FALSE,
scale = TRUE,
omethod = c("DP", "RBFGS"),
max_iter = 50L,
thresh = 0.01,
use_verbose = FALSE
)
Arguments
f |
Either a numeric matrix or a numeric 3D array specifying the functions that need to be jointly clustered and aligned.
If this is multidimensional functional data, it is advised that
|
time |
A numeric vector of length |
K |
An integer value specifying the number of clusters. Defaults to
|
seeds |
An integer vector of length |
centroid_type |
A string specifying the type of centroid to compute.
Choices are |
nonempty |
An integer value specifying the minimum number of curves per
cluster during the assignment step. Set it to a positive value to avoid the
problem of empty clusters. Defaults to |
lambda |
A numeric value specifying the elasticity. Defaults to |
showplot |
A Boolean specifying whether to show plots. Defaults to
|
smooth_data |
A Boolean specifying whether to smooth data using a box
filter. Defaults to |
sparam |
An integer value specifying the number of box filters applied.
Defaults to |
parallel |
A Boolean specifying whether parallel mode (using
|
alignment |
A Boolean specifying whether to perform alignment. Defaults
to |
rotation |
A Boolean specifying whether to perform rotation. Defaults to
to |
scale |
A Boolean specifying whether to scale curves to unit length. Defaults
to |
omethod |
A string specifying which method should be used to solve the
optimization problem that provides estimated warping functions. Choices are
|
max_iter |
An integer value specifying the maximum number of iterations.
Defaults to |
thresh |
A numeric value specifying a threshold on the cost function
below which convergence is assumed. Defaults to |
use_verbose |
A Boolean specifying whether to display information about
the calculations in the console. Defaults to |
Value
An object of class fdakma
which is a list containing:
-
f0
: the original functions; -
q0
: the original SRSFs; -
fn
: the aligned functions as matrices or a 3D arrays of the same shape thanf0
by clusters in a list; -
qn
: the aligned SRSFs as matrices or a 3D arrays of the same shape thanf0
separated in clusters in a list; -
labels
: the cluster memberships as an integer vector; -
templates
: the centroids in the original functional space; -
templates.q
: the centroids in SRSF space; -
distances_to_center
: A numeric vector storing the distances of each observed curve to its center; -
gam
: the warping functions as matrices or a 3D arrays of the same shape thanf0
by clusters in a list; -
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.
Tucker, J. D., Wu, W., Srivastava, A., Generative models for functional 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
## Not run:
out <- kmeans_align(growth_vel$f, growth_vel$time, K = 2)
## End(Not run)