Learn R Programming

⚠️There's a newer version (0.1.11) of this package.Take me there.

mlr3cluster

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.

Installation

Install the last release from CRAN:

install.packages("mlr3cluster")

Install the development version from GitHub:

devtools::install_github("mlr-org/mlr3cluster")

Feature Overview

The current version of mlr3cluster contains:

  • A selection of 22 clustering learners that represent a wide variety of clusterers: partitional, hierarchical, fuzzy, etc.
  • A selection of 4 performance measures
  • Two built-in tasks to get started with clustering

Also, the package is integrated with mlr3viz which enables you to create great visualizations with just one line of code!

Cluster Analysis

Cluster Learners

IDLearnerPackage
clust.agnesAgglomerative Hierarchical Clusteringcluster
clust.apAffinity Propagation Clusteringapcluster
clust.cmeansFuzzy C-Means Clusteringe1071
clust.cobwebCobweb Clustering AlgorithmRWeka
clust.dbscanDensity-based Clusteringdbscan
clust.dbscan_fpcDensity-based Clustering with fpcfpc
clust.dianaDivisive Hierarchical Clusteringcluster
clust.emExpectation-Maximization ClusteringRWeka
clust.fannyFuzzy Clusteringcluster
clust.featurelessSimple Featureless Clusteringmlr3cluster
clust.ffFarthestFirst Clustering AlgorithmRWeka
clust.hdbscanHDBSCAN Clusteringdbscan
clust.hclustAgglomerative Hierarchical Clusteringstats
clust.kkmeansKernel K-Means Clusteringkernlab
clust.kmeansK-Means Clusteringstats
clust.mclustGaussian Mixture Models-Based Clusteringmclust
clust.MBatchKMeansMini Batch K-Means ClusteringClusterR
clust.meanshiftMean Shift ClusteringLPCM
clust.opticsOPTICS Clusteringdbscan
clust.pamClustering Around Medoidscluster
clust.SimpleKMeansK-Means Clustering (WEKA)RWeka
clust.xmeansK-Means with Automatic Determination of kRWeka

Cluster Measures

IDMeasurePackage
clust.dunnDunn indexfpc
clust.chCalinski Harabasz Pseudo F-Statisticfpc
clust.silhouetteRousseeuw's Silhouette Quality Indexcluster
clust.wssWithin Sum of Squaresfpc

Example

library(mlr3)
library(mlr3cluster)

task = tsk("usarrests")
learner = lrn("clust.kmeans")
learner$train(task)
preds = learner$predict(task = task)

More Resources

Check out the blogpost for a more detailed introduction to the package. Also, mlr3book has a section on clustering.

Future Plans

  • Add more learners and measures
  • Integrate the package with mlr3pipelines (work in progress)

If you have any questions, feedback or ideas, feel free to open an issue here.

Copy Link

Version

Install

install.packages('mlr3cluster')

Monthly Downloads

4,871

Version

0.1.9

License

LGPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Damir Pulatov

Last Published

March 18th, 2024

Functions in mlr3cluster (0.1.9)

LearnerClust

Cluster Learner
PredictionClust

Prediction Object for Cluster Analysis
mlr_learners_clust.SimpleKMeans

K-Means Clustering Learner from Weka
as_prediction_clust

Convert to a Cluster Prediction
mlr3cluster-package

mlr3cluster: Cluster Extension for 'mlr3'
MeasureClust

Cluster Measure
as_task_clust

Convert to a Cluster Task
mlr_learners_clust.agnes

Agglomerative Hierarchical Clustering Learner
TaskClust

Cluster Task
mlr_learners_clust.MBatchKMeans

Mini Batch K-Means Clustering Learner
mlr_learners_clust.featureless

Featureless Clustering Learner
mlr_learners_clust.ff

Farthest First Clustering Learner
mlr_learners_clust.em

Expectation-Maximization Clustering Learner
mlr_learners_clust.cobweb

Cobweb Clustering Learner
mlr_learners_clust.dbscan

Density-based Spatial Clustering of Applications with Noise (DBSCAN) Clustering Learner
mlr_learners_clust.ap

Affinity Propagation Clustering Learner
mlr_learners_clust.cmeans

Fuzzy C-Means Clustering Learner
mlr_learners_clust.fanny

Fuzzy Analysis Clustering Learner
mlr_learners_clust.dbscan_fpc

Density-based Spatial Clustering of Applications with Noise (DBSCAN) Clustering Learner
mlr_learners_clust.diana

Divisive Hierarchical Clustering Learner
mlr_learners_clust.xmeans

X-means Clustering Learner
mlr_learners_clust.hclust

Agglomerative Hierarchical Clustering Learner
mlr_learners_clust.optics

Ordering Points to Identify the Clustering Structure (OPTICS) Clustering Learner
mlr_learners_clust.kkmeans

Kernel K-Means Clustering Learner
mlr_tasks_usarrests

US Arrests Cluster Task
mlr_learners_clust.pam

Partitioning Around Medoids Clustering Learner
mlr_measures_clust.ch

Calinski Harabasz Pseudo F-Statistic
mlr_learners_clust.kmeans

K-Means Clustering Learner
mlr_measures_clust.dunn

Dunn Index
mlr_measures_clust.silhouette

Rousseeuw's Silhouette Quality Index
mlr_measures_clust.wss

Within Sum of Squares
mlr_tasks_ruspini

Ruspini Cluster Task
mlr_learners_clust.mclust

Gaussian Mixture Models-Based Clustering Learner
mlr_learners_clust.meanshift

Mean Shift Clustering Learner
mlr_learners_clust.hdbscan

Hierarchical DBSCAN (HDBSCAN) Clustering Learner