
Package website: release \| dev
Cluster analysis for mlr3.
mlr3cluster is an extension package for cluster analysis within the mlr3 ecosystem. It is a successor of clustering capabilities of mlr2.
Install the last release from CRAN:
install.packages("mlr3cluster")
Install the development version from GitHub:
# install.packages("pak")
pak::pak("mlr-org/mlr3cluster")
The current version of mlr3cluster contains:
Also, the package is integrated with mlr3viz which enables you to create great visualizations with just one line of code!
| Key | Label | Packages | |:---|:---|:---| | clust.MBatchKMeans | Mini Batch K-Means | ClusterR | | clust.SimpleKMeans | K-Means (Weka) | RWeka | | clust.agnes | Agglomerative Nesting | cluster | | clust.ap | Affinity Propagation | apcluster | | clust.bico | BICO | stream | | clust.birch | BIRCH | stream | | clust.clara | CLARA | cluster, clue | | clust.cmeans | Fuzzy C-Means | e1071, clue | | clust.cobweb | Cobweb | RWeka | | clust.dbscan | DBSCAN | dbscan | | clust.dbscan_fpc | DBSCAN (fpc) | fpc | | clust.diana | Divisive Analysis | cluster | | clust.em | Expectation-Maximization | RWeka | | clust.fanny | Fuzzy Analysis | cluster | | clust.featureless | Featureless Clustering Learner | | | clust.ff | Farthest First | RWeka | | clust.flexmix | Finite Mixture Model | flexmix, mvtnorm | | clust.genie | Genie Hierarchical Clustering | genieclust | | clust.gmeans | G-Means | gmeans | | clust.hclust | Hierarchical Clustering | stats | | clust.hdbscan | HDBSCAN | dbscan | | clust.kcca | K-Centroids Cluster Analysis | flexclust | | clust.kkmeans | Kernel K-Means | kernlab | | clust.kmeans | K-Means | stats, clue | | clust.kmeans_rcpp | K-Means (ClusterR) | ClusterR | | clust.kmodes | K-Modes | klaR | | clust.kproto | K-Prototypes | clustMixType | | clust.mclust | Gaussian Mixture Model | mclust | | clust.meanshift | Mean Shift | LPCM | | clust.movMF | von Mises-Fisher Mixture | movMF | | clust.optics | OPTICS | dbscan | | clust.pam | Partitioning Around Medoids | cluster, clue | | clust.protoclust | Prototype Hierarchical Clustering | protoclust | | clust.skmeans | Spherical K-Means | skmeans | | clust.som | Self-Organizing Maps | kohonen | | clust.specc | Spectral Clustering | kernlab | | clust.stdbscan | ST-DBSCAN | stdbscan | | clust.tclust | Robust Trimmed Clustering | tclust | | clust.xmeans | X-Means | RWeka |
| Key | Label | Packages | |:---|:---|:---| | clust.avg_between | Average Between | cluster | | clust.avg_within | Average Within | cluster | | clust.ch | Calinski Harabasz | | | clust.davies_bouldin | Davies-Bouldin | | | clust.dunn | Dunn | cluster | | clust.dunn2 | Dunn2 | cluster | | clust.entropy | Entropy | | | clust.pearsongamma | Pearson Gamma | cluster | | clust.silhouette | Silhouette | cluster | | clust.sse_ratio | Within/Total Ratio | | | clust.wb_ratio | Within/Between Ratio | cluster | | clust.wss | Within Sum of Squares | |
library(mlr3)
library(mlr3cluster)
task = tsk("usarrests")
task
#>
#> ── <TaskClust> (50x4): US Arrests ──────────────────────────────────────────────
#> • Target:
#> • Properties: -
#> • Features (4):
#> • int (2): Assault, UrbanPop
#> • dbl (2): Murder, Rape
learner = lrn("clust.kmeans")
prediction = learner$train(task)$predict(task)
measures = msrs(c("clust.wss", "clust.silhouette"))
prediction$score(measures, task)
#> clust.wss clust.silhouette
#> 9.639903e+04 5.926554e-01
Check out the blogpost for a more detailed introduction to the package. Also, mlr3book has a section on clustering.
If you have any questions, feedback or ideas, feel free to open an issue here.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.