kmeans {squat} | R Documentation |
QTS K-Means Alignment Algorithm
Description
This function massages the input quaternion time series to feed them into the k-means alignment algorithm for jointly clustering and aligning the input QTS.
Usage
kmeans(x, n_clusters, ...)
## Default S3 method:
kmeans(
x,
n_clusters = 1,
iter_max = 10,
nstart = 1,
algorithm = c("Hartigan-Wong", "Lloyd", "Forgy", "MacQueen"),
trace = FALSE,
...
)
## S3 method for class 'qts_sample'
kmeans(
x,
n_clusters = 1L,
seeds = NULL,
seeding_strategy = c("kmeans++", "exhaustive-kmeans++", "exhaustive", "hclust"),
warping_class = c("affine", "dilation", "none", "shift", "srsf"),
centroid_type = "mean",
metric = c("l2", "pearson"),
cluster_on_phase = FALSE,
use_fence = FALSE,
...
)
Arguments
x |
Either a numeric matrix of data, or an object that can be coerced to such a matrix (such as a numeric vector or a data frame with all numeric columns) or an object of class qts_sample. |
n_clusters |
An integer value specifying the number of clusters to be look for. |
... |
not used. |
iter_max |
An integer value specifying the maximum number of iterations
for terminating the k-mean algorithm. Defaults to |
nstart |
if |
algorithm |
character: may be abbreviated. Note that
|
trace |
logical or integer number, currently only used in the
default method ( |
seeds |
An integer value or vector specifying the indices of the initial
centroids. If an integer vector, it is interpreted as the indices of the
intial centroids and should therefore be of length |
seeding_strategy |
A character string specifying the strategy for
choosing the initial centroids in case the argument |
warping_class |
A string specifying the warping class Choices are
|
centroid_type |
A string specifying the type of centroid to compute.
Choices are |
metric |
A string specifying the metric used to compare curves. Choices
are |
cluster_on_phase |
A boolean specifying whether clustering should be
based on phase variation or amplitude variation. Defaults to |
use_fence |
A boolean specifying whether the fence algorithm should be
used to robustify the algorithm against outliers. Defaults to |
Value
An object of class stats::kmeans
or stats::hclust
or
dbscan_fast
if the input x
is NOT of class qts_sample
. Otherwise,
an object of class qtsclust
which is effectively a list with four
components:
-
qts_aligned
: An object of classqts_sample
storing the sample of aligned QTS; -
qts_centers
: A list of objects of classqts
representing the centers of the clusters; -
best_clustering
: An object of classfdacluster::caps
storing the results of the best k-mean alignment result among all initialization that were tried. -
call_name
: A string storing the name of the function that was used to produce the clustering structure; -
call_args
: A list containing the exact arguments that were passed to the functioncall_name
that produced this output.
Examples
out <- kmeans(vespa64$igp[1:10], n_clusters = 2)