| optimize_clusters | R Documentation |
Function to Optimize Clusters Based on the Calinski-Harabasz Index
optimize_clusters(
ncs,
class_vec,
method = c("ks", "kmeans"),
min_m = 2,
max_m = NULL,
ms = NULL,
maxit = 100,
q = seq(0.1, 0.9, by = 0.1)
)
ncs |
Vector of non-conformity scores |
class_vec |
Vector of class labels |
method |
Clustering method to use, either 'ks' for Kolmogorov-Smirnov or 'kmeans' for K-means clustering |
min_m |
Minimum number of clusters to consider |
max_m |
Maximum number of clusters to consider. If NULL, defaults to the number of unique classes minus one |
ms |
Vector of specific numbers of clusters to consider. If NULL, defaults to a sequence from min_m to max_m |
maxit |
Maximum number of iterations for the clustering algorithm |
q |
Quantiles to use for K-means clustering, default is a sequence from 0.1 to 0.9 in steps of 0.1 |
A vector of cluster assignments, with attributes containing the clusters, coverage gaps, method used, number of clusters, and the Calinski-Harabasz index
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.