View source: R/fast_clara_jaccard.R
fast_clara_jaccard | R Documentation |
Implements a CLARA (Clustering Large Applications) strategy using Jaccard dissimilarity computed on individual patients state matrices. The algorithm repeatedly samples subsets of the data, performs PAM clustering on each subset, and selects the medoids that minimise the total dissimilarity across the full dataset. Final assignments are made by mapping all data points to the nearest selected medoid.
fast_clara_jaccard(
data,
k,
samples = 20,
samplesize = NULL,
seed = 123,
frac = 1
)
data |
A state matrix of censored time-to-event indicators as computed by the |
k |
Number of returned clusters. |
samples |
Number of random samples drawn from the analysed population. |
samplesize |
Number of patients per sample (default: min(50 + 5k, ncol(data))). |
seed |
Random seed for reproducibility (default: 123). |
frac |
Fraction of the population to use for cost computation (default: 1). |
This implementation adapts the original CLARA method described by Kaufman and Rousseeuw (1990) in "Finding Groups in Data: An Introduction to Cluster Analysis".
A list with index of patients from the sample a, medoid indices, cluster assignment, and cost.
An integer vector of cluster assignments for each patient.
Indices of medoids associated witht the lower cost.
Indices of the sampled columns used in clustering.
Total cost (sum of dissimilarities to assigned medoids).
To improve efficiency, the function used fastpam procedure from the fastkmedoids library and uses optimized Jaccard index computation.
For simulation purpose, the frac
parameter can be used to reduce time when computing the cost for each sample. The final cost is given using medoids associated with lower cost computed on fractionned data. A final analysis using the proper CLARA method should be conducted setting frac
to 1.
Kaufman, L. & Rousseeuw, P. J. (1990). Finding Groups in Data: An Introduction to Cluster Analysis. Wiley.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.