Perform cluster analysis of time series using their feature vectors
cluster(
data,
norm_method = c("zScore", "Sigmoid", "RobustSigmoid", "MinMax", "MaxAbs"),
unit_int = FALSE,
clust_method = c("kmeans", "hclust", "mclust"),
k = 2,
features = NULL,
na_removal = c("feature", "sample"),
seed = 123,
...
)object of class feature_cluster containing the clustering algorithm and a tidy version of clusters joined to the input dataset ready for further analysis
feature_calculations object containing the raw feature matrix produced by theft::calculate_features
character denoting the rescaling/normalising method to apply. Can be one of "zScore", "Sigmoid", "RobustSigmoid", "MinMax", or "MaxAbs". Defaults to "zScore"
Boolean whether to rescale into unit interval [0,1] after applying normalisation method. Defaults to FALSE
character specifying the clustering algorithm to use. Can be one of "kmeans" for k-means clustering, "hclust" for hierarchical clustering, or "mclust" for Gaussian mixture model clustering. Defaults to "kMeans"
integer denoting the number of clusters to extract. Defaults to 2
character vector denoting the names of time-series features to use in the clustering algorithm. Defaults to NULL for no feature filtering and usage of the entire feature matrix
character defining the way to deal with NAs produced during feature calculation. Can be one of "feature" or "sample". "feature" removes all features that produced any NAs in any sample, keeping the number of samples the same. "sample" omits all samples that produced at least one NA. Defaults to "feature"
integer to fix R's random number generator to ensure reproducibility. Defaults to 123
arguments to be passed to stats::kmeans or stats::hclust, or mclust::Mclust depending on selection in clust_method
Trent Henderson
library(theft)
features <- theft::calculate_features(theft::simData,
feature_set = "catch22")
clusts <- cluster(features,
k = 6)
Run the code above in your browser using DataLab