Cluster analysis formlr3.
mlr3cluster is an extension package for clusteranalysis within themlr3 ecosystem. Itis a successor of clustering capabilities ofmlr2.
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 ofmlr3cluster contains:
Also, the package is integrated withmlr3viz whichenables you to create great visualizations with just one line ofcode!
| Key | Label | Packages |
|---|---|---|
| clust.MBatchKMeans | Mini Batch K-Means | ClusterR |
| clust.SimpleKMeans | K-Means (Weka) | RWeka |
| clust.agnes | Agglomerative Hierarchical Clustering | cluster |
| clust.ap | Affinity Propagation Clustering | apcluster |
| clust.bico | BICO Clustering | stream |
| clust.birch | BIRCH Clustering | stream |
| clust.cmeans | Fuzzy C-Means Clustering Learner | e1071 |
| clust.cobweb | Cobweb Clustering | RWeka |
| clust.dbscan | Density-Based Clustering | dbscan |
| clust.dbscan_fpc | Density-Based Clustering with fpc | fpc |
| clust.diana | Divisive Hierarchical Clustering | cluster |
| clust.em | Expectation-Maximization Clustering | RWeka |
| clust.fanny | Fuzzy Analysis Clustering | cluster |
| clust.featureless | Featureless Clustering | |
| clust.ff | Farthest First Clustering | RWeka |
| clust.hclust | Agglomerative Hierarchical Clustering | stats |
| clust.hdbscan | HDBSCAN Clustering | dbscan |
| clust.kkmeans | Kernel K-Means | kernlab |
| clust.kmeans | K-Means | stats,clue |
| clust.mclust | Gaussian Mixture Models Clustering | mclust |
| clust.meanshift | Mean Shift Clustering | LPCM |
| clust.optics | OPTICS Clustering | dbscan |
| clust.pam | Partitioning Around Medoids | cluster |
| clust.xmeans | X-means | RWeka |
| Key | Label | Packages |
|---|---|---|
| clust.ch | Calinski Harabasz | fpc |
| clust.dunn | Dunn | fpc |
| clust.silhouette | Silhouette | cluster |
| clust.wss | Within Sum of Squares | fpc |
library(mlr3)library(mlr3cluster)task=tsk("usarrests")task#>#> ── <TaskClust> (50x4): US Arrests ──────────────────────────────────────────────#> • Target:#> • Properties: -#> • Features (4):#> • int (2): Assault, UrbanPop#> • dbl (2): Murder, Rapelearner=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-01Check out theblogpostfor a more detailed introduction to the package. Also,mlr3bookhas a section on clustering.
If you have any questions, feedback or ideas, feel free to open anissuehere.