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.
sits_cluster_dendro(
samples = NULL,
bands = NULL,
dist_method = "dtw_basic",
linkage = "ward.D2",
k = NULL,
palette = "RdYlGn",
.plot = TRUE,
...
)
Tibble with added "cluster" column.
Tibble with input set of time series.
Bands to be used in the clustering.
Distance method.
Agglomeration method. Can be any `hclust` method (see `hclust`). Default is 'ward.D2'.
Desired number of clusters (overrides default value)
Color palette as per `grDevices::hcl.pals()` function.
Plot the dendrogram?
Additional parameters to be passed to dtwclust::tsclust() function.
Rolf Simoes, rolf.simoes@inpe.br
"dtwclust" package (https://CRAN.R-project.org/package=dtwclust)
if (sits_run_examples()) {
clusters <- sits_cluster_dendro(cerrado_2classes)
}
Run the code above in your browser using DataLab