Learn R Programming

sits (version 1.1.0)

sits_clustering: Find clusters in time series samples

Description

These functions support hierarchical agglomerative clustering in sits. They provide support from creating a dendrogram and using it for cleaning samples.

sits_cluster_dendro() takes a tibble containing time series and produces a sits tibble with an added "cluster" column. The function first calculates a dendrogram and obtains a validity index for best clustering using the adjusted Rand Index. After cutting the dendrogram using the chosen validity index, it assigns a cluster to each sample.

sits_cluster_frequency() computes the contingency table between labels and clusters and produces a matrix. It needs as input a tibble produced by sits_cluster_dendro().

sits_cluster_clean() takes a tibble with time series that has an additional `cluster` produced by sits_cluster_dendro() and removes labels that are minority in each cluster.

Usage

sits_cluster_dendro(
  samples = NULL,
  bands = NULL,
  dist_method = "dtw_basic",
  linkage = "ward.D2",
  k = NULL,
  palette = "RdYlGn",
  .plot = TRUE,
  ...
)

Value

Tibble with added "cluster" column.

Arguments

samples

Tibble with input set of time series.

bands

Bands to be used in the clustering.

dist_method

Distance method.

linkage

Agglomeration method. Can be any `hclust` method (see `hclust`). Default is 'ward.D2'.

k

Desired number of clusters (overrides default value)

palette

Color palette as per `grDevices::hcl.pals()` function.

.plot

Plot the dendrogram?

...

Additional parameters to be passed to dtwclust::tsclust() function.

Author

Rolf Simoes, rolf.simoes@inpe.br

References

"dtwclust" package (https://CRAN.R-project.org/package=dtwclust)

Examples

Run this code
if (sits_run_examples()) {
    clusters <- sits_cluster_dendro(cerrado_2classes)
}

Run the code above in your browser using DataLab