| Title: | Cluster Extension for 'mlr3' |
|---|---|
| Description: | Extends the 'mlr3' package with cluster analysis. |
| Authors: | Maximilian Mücke [aut, cre] (ORCID: <https://orcid.org/0009-0000-9432-9795>), Damir Pulatov [aut], Michel Lang [aut] (ORCID: <https://orcid.org/0000-0001-9754-0393>), Marc Becker [ctb] (ORCID: <https://orcid.org/0000-0002-8115-0400>) |
| Maintainer: | Maximilian Mücke <[email protected]> |
| License: | LGPL-3 |
| Version: | 0.3.0 |
| Built: | 2026-06-01 09:37:45 UTC |
| Source: | https://github.com/mlr-org/mlr3cluster |
Extends the 'mlr3' package with cluster analysis.
Maintainer: Maximilian Mücke [email protected] (ORCID)
Authors:
Damir Pulatov [email protected]
Michel Lang [email protected] (ORCID)
Other contributors:
Marc Becker [email protected] (ORCID) [contributor]
Useful links:
Report bugs at https://github.com/mlr-org/mlr3cluster/issues
Convert object to a PredictionClust.
as_prediction_clust(x, ...) ## S3 method for class 'PredictionClust' as_prediction_clust(x, ...) ## S3 method for class 'data.frame' as_prediction_clust(x, ...)as_prediction_clust(x, ...) ## S3 method for class 'PredictionClust' as_prediction_clust(x, ...) ## S3 method for class 'data.frame' as_prediction_clust(x, ...)
x |
(any) |
... |
(any) |
# create a prediction object task = tsk("usarrests") learner = lrn("clust.cmeans", predict_type = "prob") learner$train(task) p = learner$predict(task) # convert to a data.table tab = as.data.table(p) # convert back to a Prediction as_prediction_clust(tab) # split data.table into a 3 data.tables based on UrbanPop f = cut(task$data(rows = tab$row_ids)$UrbanPop, 3) tabs = split(tab, f) # convert back to list of predictions preds = lapply(tabs, as_prediction_clust) # calculate performance in each group sapply(preds, function(p) p$score(task = task))# create a prediction object task = tsk("usarrests") learner = lrn("clust.cmeans", predict_type = "prob") learner$train(task) p = learner$predict(task) # convert to a data.table tab = as.data.table(p) # convert back to a Prediction as_prediction_clust(tab) # split data.table into a 3 data.tables based on UrbanPop f = cut(task$data(rows = tab$row_ids)$UrbanPop, 3) tabs = split(tab, f) # convert back to list of predictions preds = lapply(tabs, as_prediction_clust) # calculate performance in each group sapply(preds, function(p) p$score(task = task))
Convert object to a TaskClust. This is a S3 generic, specialized for at least the following objects:
TaskClust: ensure the identity.
data.frame() and mlr3::DataBackend: provides an alternative to calling constructor of TaskClust.
as_task_clust(x, ...) ## S3 method for class 'TaskClust' as_task_clust(x, clone = FALSE, ...) ## S3 method for class 'data.frame' as_task_clust(x, id = deparse1(substitute(x)), ...) ## S3 method for class 'DataBackend' as_task_clust(x, id = deparse1(substitute(x)), ...) ## S3 method for class 'formula' as_task_clust(x, data, id = deparse1(substitute(data)), ...)as_task_clust(x, ...) ## S3 method for class 'TaskClust' as_task_clust(x, clone = FALSE, ...) ## S3 method for class 'data.frame' as_task_clust(x, id = deparse1(substitute(x)), ...) ## S3 method for class 'DataBackend' as_task_clust(x, id = deparse1(substitute(x)), ...) ## S3 method for class 'formula' as_task_clust(x, data, id = deparse1(substitute(data)), ...)
x |
(any) |
... |
(any) |
clone |
( |
id |
( |
data |
( |
as_task_clust(datasets::USArrests)as_task_clust(datasets::USArrests)
This Learner specializes mlr3::Learner for cluster problems:
task_type is set to "clust".
Creates mlr3::Predictions of class PredictionClust.
Possible values for predict_types are:
"partition": Integer indicating the cluster membership.
"prob": Probability for belonging to each cluster.
Predefined learners can be found in the mlr3misc::Dictionary mlr3::mlr_learners.
mlr3::Learner -> LearnerClust
assignments(NULL | vector())
Cluster assignments from learned model.
save_assignments(logical(1))
Should assignments for 'train' data be saved in the learner?
Default is TRUE.
new()
Creates a new instance of this R6 class.
LearnerClust$new( id, param_set = ps(), predict_types = "partition", feature_types = character(), properties = character(), packages = character(), label = NA_character_, man = NA_character_ )
id(character(1))
Identifier for the new instance.
param_set(paradox::ParamSet)
Set of hyperparameters.
predict_types(character())
Supported predict types. Must be a subset of mlr_reflections$learner_predict_types.
feature_types(character())
Feature types the learner operates on. Must be a subset of mlr_reflections$task_feature_types.
properties(character())
Set of properties of the mlr3::Learner.
Must be a subset of mlr_reflections$learner_properties.
The following properties are currently standardized and understood by learners in mlr3:
"missings": The learner can handle missing values in the data.
"weights": The learner supports observation weights.
"importance": The learner supports extraction of importance scores, i.e. comes with an $importance() extractor function (see section on optional extractors in mlr3::Learner).
"selected_features": The learner supports extraction of the set of selected features, i.e. comes with a $selected_features() extractor function (see section on optional extractors in mlr3::Learner).
"oob_error": The learner supports extraction of estimated out of bag error, i.e. comes with a oob_error() extractor function (see section on optional extractors in mlr3::Learner).
packages(character())
Set of required packages.
A warning is signaled by the constructor if at least one of the packages is not installed,
but loaded (not attached) later on-demand via requireNamespace().
label(character(1))
Label for the new instance.
man(character(1))
String in the format [pkg]::[topic] pointing to a manual page for this object.
The referenced help package can be opened via method $help().
reset()
Reset assignments field before calling parent's reset().
LearnerClust$reset()
clone()
The objects of this class are cloneable with this method.
LearnerClust$clone(deep = FALSE)
deepWhether to make a deep clone.
library(mlr3) library(mlr3cluster) ids = mlr_learners$keys("^clust") ids # get a specific learner from mlr_learners: learner = lrn("clust.kmeans") print(learner)library(mlr3) library(mlr3cluster) ids = mlr_learners$keys("^clust") ids # get a specific learner from mlr_learners: learner = lrn("clust.kmeans") print(learner)
This measure specializes mlr3::Measure for cluster analysis:
task_type is set to "clust".
Possible values for predict_type are "partition" and "prob".
Predefined measures can be found in the mlr3misc::Dictionary mlr3::mlr_measures.
mlr3::Measure -> MeasureClust
new()
Creates a new instance of this R6 class.
MeasureClust$new( id, range, minimize = NA, aggregator = NULL, properties = character(), predict_type = "partition", task_properties = character(), packages = character(), label = NA_character_, man = NA_character_ )
id(character(1))
Identifier for the new instance.
range(numeric(2))
Feasible range for this measure as c(lower_bound, upper_bound).
Both bounds may be infinite.
minimize(logical(1))
Set to TRUE if good predictions correspond to small values,
and to FALSE if good predictions correspond to large values.
If set to NA (default), tuning this measure is not possible.
aggregator(function(x) | NULL)
Function to aggregate individual performance scores x where x is a numeric vector.
If NULL, defaults to mean().
properties(character())
Properties of the measure.
Must be a subset of mlr_reflections$measure_properties.
Supported by mlr3:
"requires_task" (requires the complete mlr3::Task),
"requires_learner" (requires the trained mlr3::Learner),
"requires_train_set" (requires the training indices from the mlr3::Resampling), and
"na_score" (the measure is expected to occasionally return NA or NaN).
predict_type(character(1))
Required predict type of the mlr3::Learner.
Possible values are stored in mlr_reflections$learner_predict_types.
task_properties(character())
Required task properties, see mlr3::Task.
packages(character())
Set of required packages.
A warning is signaled by the constructor if at least one of the packages is not installed,
but loaded (not attached) later on-demand via requireNamespace().
label(character(1))
Label for the new instance.
man(character(1))
String in the format [pkg]::[topic] pointing to a manual page for this object.
The referenced help package can be opened via method $help().
Example cluster measures: clust.dunn
Agglomerative hierarchical clustering.
Calls cluster::agnes() from package cluster.
The predict method uses stats::cutree() which cuts the tree resulting from
hierarchical clustering into specified number of groups (see parameter k).
The default number for k is 2.
This mlr3::Learner can be instantiated via the dictionary mlr3::mlr_learners or with the associated sugar function mlr3::lrn():
mlr_learners$get("clust.agnes")
lrn("clust.agnes")
Task type: “clust”
Predict Types: “partition”
Feature Types: “logical”, “integer”, “numeric”
Required Packages: mlr3, mlr3cluster, cluster
| Id | Type | Default | Levels | Range |
| metric | character | euclidean | euclidean, manhattan | - |
| stand | logical | FALSE | TRUE, FALSE | - |
| method | character | average | average, single, complete, ward, weighted, flexible, gaverage | - |
| trace.lev | integer | 0 | |
|
| k | integer | 2 | |
|
| par.method | untyped | - | - |
mlr3::Learner -> mlr3cluster::LearnerClust -> LearnerClustAgnes
new()
Creates a new instance of this R6 class.
LearnerClustAgnes$new()
clone()
The objects of this class are cloneable with this method.
LearnerClustAgnes$clone(deep = FALSE)
deepWhether to make a deep clone.
Kaufman, Leonard, Rousseeuw, J P (2009). Finding groups in data: an introduction to cluster analysis. John Wiley & Sons.
Chapter in the mlr3book: https://mlr3book.mlr-org.com/chapters/chapter2/data_and_basic_modeling.html#sec-learners
Package mlr3extralearners for more learners.
as.data.table(mlr_learners) for a table of available Learners in the running session (depending on the loaded packages).
mlr3pipelines to combine learners with pre- and postprocessing steps.
Extension packages for additional task types:
mlr3proba for probabilistic supervised regression and survival analysis.
mlr3cluster for unsupervised clustering.
mlr3tuning for tuning of hyperparameters, mlr3tuningspaces for established default tuning spaces.
Other Learner:
mlr_learners_clust.MBatchKMeans,
mlr_learners_clust.SimpleKMeans,
mlr_learners_clust.ap,
mlr_learners_clust.bico,
mlr_learners_clust.birch,
mlr_learners_clust.clara,
mlr_learners_clust.cmeans,
mlr_learners_clust.cobweb,
mlr_learners_clust.dbscan,
mlr_learners_clust.dbscan_fpc,
mlr_learners_clust.diana,
mlr_learners_clust.em,
mlr_learners_clust.fanny,
mlr_learners_clust.featureless,
mlr_learners_clust.ff,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.specc,
mlr_learners_clust.xmeans
# Define the Learner and set parameter values learner = lrn("clust.agnes") print(learner) # Define a Task task = tsk("usarrests") # Train the learner on the task learner$train(task) # Print the model print(learner$model) # Make predictions for the task prediction = learner$predict(task) # Score the predictions prediction$score(task = task)# Define the Learner and set parameter values learner = lrn("clust.agnes") print(learner) # Define a Task task = tsk("usarrests") # Train the learner on the task learner$train(task) # Print the model print(learner$model) # Make predictions for the task prediction = learner$predict(task) # Score the predictions prediction$score(task = task)
Affinity Propagation clustering.
Calls apcluster::apcluster() from package apcluster.
Note that apcluster::apcluster() doesn't have a default for the similarity function.
The predict method computes the closest cluster exemplar to find the
cluster memberships for new data.
The code is taken from
StackOverflow
answer by the apcluster package maintainer.
This mlr3::Learner can be instantiated via the dictionary mlr3::mlr_learners or with the associated sugar function mlr3::lrn():
mlr_learners$get("clust.ap")
lrn("clust.ap")
Task type: “clust”
Predict Types: “partition”
Feature Types: “logical”, “integer”, “numeric”
Required Packages: mlr3, mlr3cluster, apcluster
| Id | Type | Default | Levels | Range |
| s | untyped | - | - | |
| p | untyped | NA_real_ | - | |
| q | numeric | NA | |
|
| maxits | integer | 1000 | |
|
| convits | integer | 100 | |
|
| lam | numeric | 0.9 | |
|
| includeSim | logical | FALSE | TRUE, FALSE | - |
| details | logical | FALSE | TRUE, FALSE | - |
| nonoise | logical | FALSE | TRUE, FALSE | - |
| seed | integer | NA |
|
mlr3::Learner -> mlr3cluster::LearnerClust -> LearnerClustAP
new()
Creates a new instance of this R6 class.
LearnerClustAP$new()
clone()
The objects of this class are cloneable with this method.
LearnerClustAP$clone(deep = FALSE)
deepWhether to make a deep clone.
Bodenhofer, Ulrich, Kothmeier, Andreas, Hochreiter, Sepp (2011). “APCluster: an R package for affinity propagation clustering.” Bioinformatics, 27(17), 2463–2464.
Frey, J B, Dueck, Delbert (2007). “Clustering by passing messages between data points.” science, 315(5814), 972–976.
Chapter in the mlr3book: https://mlr3book.mlr-org.com/chapters/chapter2/data_and_basic_modeling.html#sec-learners
Package mlr3extralearners for more learners.
as.data.table(mlr_learners) for a table of available Learners in the running session (depending on the loaded packages).
mlr3pipelines to combine learners with pre- and postprocessing steps.
Extension packages for additional task types:
mlr3proba for probabilistic supervised regression and survival analysis.
mlr3cluster for unsupervised clustering.
mlr3tuning for tuning of hyperparameters, mlr3tuningspaces for established default tuning spaces.
Other Learner:
mlr_learners_clust.MBatchKMeans,
mlr_learners_clust.SimpleKMeans,
mlr_learners_clust.agnes,
mlr_learners_clust.bico,
mlr_learners_clust.birch,
mlr_learners_clust.clara,
mlr_learners_clust.cmeans,
mlr_learners_clust.cobweb,
mlr_learners_clust.dbscan,
mlr_learners_clust.dbscan_fpc,
mlr_learners_clust.diana,
mlr_learners_clust.em,
mlr_learners_clust.fanny,
mlr_learners_clust.featureless,
mlr_learners_clust.ff,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.specc,
mlr_learners_clust.xmeans
# Define the Learner and set parameter values learner = lrn("clust.ap") print(learner)# Define the Learner and set parameter values learner = lrn("clust.ap") print(learner)
BICO (fast computation of k-means coresets in a data stream) clustering.
Calls stream::DSC_BICO() from package stream.
This mlr3::Learner can be instantiated via the dictionary mlr3::mlr_learners or with the associated sugar function mlr3::lrn():
mlr_learners$get("clust.bico")
lrn("clust.bico")
Task type: “clust”
Predict Types: “partition”
Feature Types: “integer”, “numeric”
Required Packages: mlr3, mlr3cluster, stream
| Id | Type | Default | Range |
| k | integer | 5 | |
| space | integer | 10 | |
| p | integer | 10 | |
| iterations | integer | 10 |
|
mlr3::Learner -> mlr3cluster::LearnerClust -> LearnerClustBICO
new()
Creates a new instance of this R6 class.
LearnerClustBICO$new()
clone()
The objects of this class are cloneable with this method.
LearnerClustBICO$clone(deep = FALSE)
deepWhether to make a deep clone.
Fichtenberger, Hendrik, Gille, Marc, Schmidt, Melanie, Schwiegelshohn, Chris, Sohler, Christian (2013). “BICO: BIRCH Meets Coresets for k-Means Clustering.” In Algorithms–ESA 2013: 21st Annual European Symposium, Sophia Antipolis, France, September 2-4, 2013. Proceedings 21, 481–492. Springer.
Hahsler M, Bolaños M, Forrest J (2017). “Introduction to stream: An Extensible Framework for Data Stream Clustering Research with R.” Journal of Statistical Software, 76(14), 1–50. doi:10.18637/jss.v076.i14.
Chapter in the mlr3book: https://mlr3book.mlr-org.com/chapters/chapter2/data_and_basic_modeling.html#sec-learners
Package mlr3extralearners for more learners.
as.data.table(mlr_learners) for a table of available Learners in the running session (depending on the loaded packages).
mlr3pipelines to combine learners with pre- and postprocessing steps.
Extension packages for additional task types:
mlr3proba for probabilistic supervised regression and survival analysis.
mlr3cluster for unsupervised clustering.
mlr3tuning for tuning of hyperparameters, mlr3tuningspaces for established default tuning spaces.
Other Learner:
mlr_learners_clust.MBatchKMeans,
mlr_learners_clust.SimpleKMeans,
mlr_learners_clust.agnes,
mlr_learners_clust.ap,
mlr_learners_clust.birch,
mlr_learners_clust.clara,
mlr_learners_clust.cmeans,
mlr_learners_clust.cobweb,
mlr_learners_clust.dbscan,
mlr_learners_clust.dbscan_fpc,
mlr_learners_clust.diana,
mlr_learners_clust.em,
mlr_learners_clust.fanny,
mlr_learners_clust.featureless,
mlr_learners_clust.ff,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.specc,
mlr_learners_clust.xmeans
# Define the Learner and set parameter values learner = lrn("clust.bico") print(learner) # Define a Task task = tsk("usarrests") # Train the learner on the task learner$train(task) # Print the model print(learner$model) # Make predictions for the task prediction = learner$predict(task) # Score the predictions prediction$score(task = task)# Define the Learner and set parameter values learner = lrn("clust.bico") print(learner) # Define a Task task = tsk("usarrests") # Train the learner on the task learner$train(task) # Print the model print(learner$model) # Make predictions for the task prediction = learner$predict(task) # Score the predictions prediction$score(task = task)
BIRCH (balanced iterative reducing clustering using hierarchies) clustering.
Calls stream::DSC_BIRCH() from package stream.
This mlr3::Learner can be instantiated via the dictionary mlr3::mlr_learners or with the associated sugar function mlr3::lrn():
mlr_learners$get("clust.birch")
lrn("clust.birch")
Task type: “clust”
Predict Types: “partition”
Feature Types: “integer”, “numeric”
Required Packages: mlr3, mlr3cluster, stream
| Id | Type | Default | Range |
| threshold | numeric | - | |
| branching | integer | - | |
| maxLeaf | integer | - | |
| maxMem | integer | 0 | |
| outlierThreshold | numeric | 0.25 |
|
mlr3::Learner -> mlr3cluster::LearnerClust -> LearnerClustBIRCH
new()
Creates a new instance of this R6 class.
LearnerClustBIRCH$new()
clone()
The objects of this class are cloneable with this method.
LearnerClustBIRCH$clone(deep = FALSE)
deepWhether to make a deep clone.
Zhang, Tian, Ramakrishnan, Raghu, Livny, Miron (1996). “BIRCH: An Efficient Data Clustering Method for Very Large Databases.” ACM sigmod record, 25(2), 103–114.
Zhang, Tian, Ramakrishnan, Raghu, Livny, Miron (1997). “BIRCH: A new data clustering algorithm and its applications.” Data Mining and Knowledge Discovery, 1, 141–182.
Hahsler M, Bolaños M, Forrest J (2017). “Introduction to stream: An Extensible Framework for Data Stream Clustering Research with R.” Journal of Statistical Software, 76(14), 1–50. doi:10.18637/jss.v076.i14.
Chapter in the mlr3book: https://mlr3book.mlr-org.com/chapters/chapter2/data_and_basic_modeling.html#sec-learners
Package mlr3extralearners for more learners.
as.data.table(mlr_learners) for a table of available Learners in the running session (depending on the loaded packages).
mlr3pipelines to combine learners with pre- and postprocessing steps.
Extension packages for additional task types:
mlr3proba for probabilistic supervised regression and survival analysis.
mlr3cluster for unsupervised clustering.
mlr3tuning for tuning of hyperparameters, mlr3tuningspaces for established default tuning spaces.
Other Learner:
mlr_learners_clust.MBatchKMeans,
mlr_learners_clust.SimpleKMeans,
mlr_learners_clust.agnes,
mlr_learners_clust.ap,
mlr_learners_clust.bico,
mlr_learners_clust.clara,
mlr_learners_clust.cmeans,
mlr_learners_clust.cobweb,
mlr_learners_clust.dbscan,
mlr_learners_clust.dbscan_fpc,
mlr_learners_clust.diana,
mlr_learners_clust.em,
mlr_learners_clust.fanny,
mlr_learners_clust.featureless,
mlr_learners_clust.ff,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.specc,
mlr_learners_clust.xmeans
# Define the Learner and set parameter values learner = lrn("clust.birch") print(learner)# Define the Learner and set parameter values learner = lrn("clust.birch") print(learner)
Clustering Large Applications (CLARA) clustering.
Calls cluster::clara() from package cluster.
CLARA extends the PAM algorithm to handle larger datasets by working on sub-datasets of fixed size.
The k parameter is set to 2 by default since cluster::clara()
doesn't have a default value for the number of clusters.
The predict method uses clue::cl_predict() to compute the
cluster memberships for new data.
This mlr3::Learner can be instantiated via the dictionary mlr3::mlr_learners or with the associated sugar function mlr3::lrn():
mlr_learners$get("clust.clara")
lrn("clust.clara")
Task type: “clust”
Predict Types: “partition”
Feature Types: “logical”, “integer”, “numeric”
Required Packages: mlr3, mlr3cluster, cluster, clue
| Id | Type | Default | Levels | Range |
| k | integer | - | |
|
| metric | character | euclidean | euclidean, manhattan, jaccard | - |
| stand | logical | FALSE | TRUE, FALSE | - |
| samples | integer | 5 | |
|
| sampsize | integer | - | |
|
| trace | integer | 0 | |
|
| medoids.x | logical | TRUE | TRUE, FALSE | - |
| keep.data | logical | TRUE | TRUE, FALSE | - |
| rngR | logical | FALSE | TRUE, FALSE | - |
| pamLike | logical | FALSE | TRUE, FALSE | - |
| correct.d | logical | TRUE | TRUE, FALSE | - |
mlr3::Learner -> mlr3cluster::LearnerClust -> LearnerClustCLARA
new()
Creates a new instance of this R6 class.
LearnerClustCLARA$new()
clone()
The objects of this class are cloneable with this method.
LearnerClustCLARA$clone(deep = FALSE)
deepWhether to make a deep clone.
Kaufman, Leonard, Rousseeuw, J P (2009). Finding groups in data: an introduction to cluster analysis. John Wiley & Sons.
Schubert, Erich, Rousseeuw, J P (2019). “Faster k-medoids clustering: improving the PAM, CLARA, and CLARANS algorithms.” In Similarity Search and Applications: 12th International Conference, SISAP 2019, Newark, NJ, USA, October 2–4, 2019, Proceedings 12, 171–187. Springer.
Chapter in the mlr3book: https://mlr3book.mlr-org.com/chapters/chapter2/data_and_basic_modeling.html#sec-learners
Package mlr3extralearners for more learners.
as.data.table(mlr_learners) for a table of available Learners in the running session (depending on the loaded packages).
mlr3pipelines to combine learners with pre- and postprocessing steps.
Extension packages for additional task types:
mlr3proba for probabilistic supervised regression and survival analysis.
mlr3cluster for unsupervised clustering.
mlr3tuning for tuning of hyperparameters, mlr3tuningspaces for established default tuning spaces.
Other Learner:
mlr_learners_clust.MBatchKMeans,
mlr_learners_clust.SimpleKMeans,
mlr_learners_clust.agnes,
mlr_learners_clust.ap,
mlr_learners_clust.bico,
mlr_learners_clust.birch,
mlr_learners_clust.cmeans,
mlr_learners_clust.cobweb,
mlr_learners_clust.dbscan,
mlr_learners_clust.dbscan_fpc,
mlr_learners_clust.diana,
mlr_learners_clust.em,
mlr_learners_clust.fanny,
mlr_learners_clust.featureless,
mlr_learners_clust.ff,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.specc,
mlr_learners_clust.xmeans
# Define the Learner and set parameter values learner = lrn("clust.clara") print(learner) # Define a Task task = tsk("usarrests") # Train the learner on the task learner$train(task) # Print the model print(learner$model) # Make predictions for the task prediction = learner$predict(task) # Score the predictions prediction$score(task = task)# Define the Learner and set parameter values learner = lrn("clust.clara") print(learner) # Define a Task task = tsk("usarrests") # Train the learner on the task learner$train(task) # Print the model print(learner$model) # Make predictions for the task prediction = learner$predict(task) # Score the predictions prediction$score(task = task)
Fuzzy c-means clustering.
Calls e1071::cmeans() from package e1071.
The centers parameter is set to 2 by default since e1071::cmeans()
doesn't have a default value for the number of clusters.
The predict method uses clue::cl_predict() to compute the
cluster memberships for new data.
This mlr3::Learner can be instantiated via the dictionary mlr3::mlr_learners or with the associated sugar function mlr3::lrn():
mlr_learners$get("clust.cmeans")
lrn("clust.cmeans")
Task type: “clust”
Predict Types: “partition”, “prob”
Feature Types: “logical”, “integer”, “numeric”
Required Packages: mlr3, mlr3cluster, e1071, clue
| Id | Type | Default | Levels | Range |
| centers | untyped | - | - | |
| iter.max | integer | 100 | |
|
| verbose | logical | FALSE | TRUE, FALSE | - |
| dist | character | euclidean | euclidean, manhattan | - |
| method | character | cmeans | cmeans, ufcl | - |
| m | numeric | 2 | |
|
| rate.par | numeric | - | |
|
| weights | untyped | 1L | - | |
| control | untyped | - | - |
mlr3::Learner -> mlr3cluster::LearnerClust -> LearnerClustCMeans
new()
Creates a new instance of this R6 class.
LearnerClustCMeans$new()
clone()
The objects of this class are cloneable with this method.
LearnerClustCMeans$clone(deep = FALSE)
deepWhether to make a deep clone.
Dimitriadou, Evgenia, Hornik, Kurt, Leisch, Friedrich, Meyer, David, Weingessel, Andreas (2008). “Misc functions of the Department of Statistics (e1071), TU Wien.” R package, 1, 5–24.
Bezdek, C J (2013). Pattern recognition with fuzzy objective function algorithms. Springer Science & Business Media.
Chapter in the mlr3book: https://mlr3book.mlr-org.com/chapters/chapter2/data_and_basic_modeling.html#sec-learners
Package mlr3extralearners for more learners.
as.data.table(mlr_learners) for a table of available Learners in the running session (depending on the loaded packages).
mlr3pipelines to combine learners with pre- and postprocessing steps.
Extension packages for additional task types:
mlr3proba for probabilistic supervised regression and survival analysis.
mlr3cluster for unsupervised clustering.
mlr3tuning for tuning of hyperparameters, mlr3tuningspaces for established default tuning spaces.
Other Learner:
mlr_learners_clust.MBatchKMeans,
mlr_learners_clust.SimpleKMeans,
mlr_learners_clust.agnes,
mlr_learners_clust.ap,
mlr_learners_clust.bico,
mlr_learners_clust.birch,
mlr_learners_clust.clara,
mlr_learners_clust.cobweb,
mlr_learners_clust.dbscan,
mlr_learners_clust.dbscan_fpc,
mlr_learners_clust.diana,
mlr_learners_clust.em,
mlr_learners_clust.fanny,
mlr_learners_clust.featureless,
mlr_learners_clust.ff,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.specc,
mlr_learners_clust.xmeans
# Define the Learner and set parameter values learner = lrn("clust.cmeans") print(learner) # Define a Task task = tsk("usarrests") # Train the learner on the task learner$train(task) # Print the model print(learner$model) # Make predictions for the task prediction = learner$predict(task) # Score the predictions prediction$score(task = task)# Define the Learner and set parameter values learner = lrn("clust.cmeans") print(learner) # Define a Task task = tsk("usarrests") # Train the learner on the task learner$train(task) # Print the model print(learner$model) # Make predictions for the task prediction = learner$predict(task) # Score the predictions prediction$score(task = task)
Cobweb clustering.
Calls RWeka::Cobweb() from package RWeka.
The predict method uses RWeka::predict.Weka_clusterer() to compute the
cluster memberships for new data.
This mlr3::Learner can be instantiated via the dictionary mlr3::mlr_learners or with the associated sugar function mlr3::lrn():
mlr_learners$get("clust.cobweb")
lrn("clust.cobweb")
Task type: “clust”
Predict Types: “partition”
Feature Types: “logical”, “integer”, “numeric”
Required Packages: mlr3, mlr3cluster, RWeka
| Id | Type | Default | Range |
| A | numeric | 1 | |
| C | numeric | 0.002 | |
| S | integer | 42 |
|
mlr3::Learner -> mlr3cluster::LearnerClust -> LearnerClustCobweb
new()
Creates a new instance of this R6 class.
LearnerClustCobweb$new()
clone()
The objects of this class are cloneable with this method.
LearnerClustCobweb$clone(deep = FALSE)
deepWhether to make a deep clone.
Witten, H I, Frank, Eibe (2002). “Data mining: practical machine learning tools and techniques with Java implementations.” Acm Sigmod Record, 31(1), 76–77.
Fisher, H D (1987). “Knowledge acquisition via incremental conceptual clustering.” Machine learning, 2, 139–172.
Gennari, H J, Langley, Pat, Fisher, Doug (1989). “Models of incremental concept formation.” Artificial intelligence, 40(1-3), 11–61.
Chapter in the mlr3book: https://mlr3book.mlr-org.com/chapters/chapter2/data_and_basic_modeling.html#sec-learners
Package mlr3extralearners for more learners.
as.data.table(mlr_learners) for a table of available Learners in the running session (depending on the loaded packages).
mlr3pipelines to combine learners with pre- and postprocessing steps.
Extension packages for additional task types:
mlr3proba for probabilistic supervised regression and survival analysis.
mlr3cluster for unsupervised clustering.
mlr3tuning for tuning of hyperparameters, mlr3tuningspaces for established default tuning spaces.
Other Learner:
mlr_learners_clust.MBatchKMeans,
mlr_learners_clust.SimpleKMeans,
mlr_learners_clust.agnes,
mlr_learners_clust.ap,
mlr_learners_clust.bico,
mlr_learners_clust.birch,
mlr_learners_clust.clara,
mlr_learners_clust.cmeans,
mlr_learners_clust.dbscan,
mlr_learners_clust.dbscan_fpc,
mlr_learners_clust.diana,
mlr_learners_clust.em,
mlr_learners_clust.fanny,
mlr_learners_clust.featureless,
mlr_learners_clust.ff,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.specc,
mlr_learners_clust.xmeans
# Define the Learner and set parameter values learner = lrn("clust.cobweb") print(learner) # Define a Task task = tsk("usarrests") # Train the learner on the task learner$train(task) # Print the model print(learner$model) # Make predictions for the task prediction = learner$predict(task) # Score the predictions prediction$score(task = task)# Define the Learner and set parameter values learner = lrn("clust.cobweb") print(learner) # Define a Task task = tsk("usarrests") # Train the learner on the task learner$train(task) # Print the model print(learner$model) # Make predictions for the task prediction = learner$predict(task) # Score the predictions prediction$score(task = task)
DBSCAN (density-based spatial clustering of applications with noise) clustering.
Calls dbscan::dbscan() from package dbscan.
This mlr3::Learner can be instantiated via the dictionary mlr3::mlr_learners or with the associated sugar function mlr3::lrn():
mlr_learners$get("clust.dbscan")
lrn("clust.dbscan")
Task type: “clust”
Predict Types: “partition”
Feature Types: “logical”, “integer”, “numeric”
Required Packages: mlr3, mlr3cluster, dbscan
| Id | Type | Default | Levels | Range |
| eps | numeric | - | |
|
| minPts | integer | 5 | |
|
| weights | untyped | - | - | |
| borderPoints | logical | TRUE | TRUE, FALSE | - |
| search | character | kdtree | kdtree, linear, dist | - |
| bucketSize | integer | 10 | |
|
| splitRule | character | SUGGEST | STD, MIDPT, FAIR, SL_MIDPT, SL_FAIR, SUGGEST | - |
| approx | numeric | 0 |
|
mlr3::Learner -> mlr3cluster::LearnerClust -> LearnerClustDBSCAN
new()
Creates a new instance of this R6 class.
LearnerClustDBSCAN$new()
clone()
The objects of this class are cloneable with this method.
LearnerClustDBSCAN$clone(deep = FALSE)
deepWhether to make a deep clone.
Hahsler M, Piekenbrock M, Doran D (2019). “dbscan: Fast Density-Based Clustering with R.” Journal of Statistical Software, 91(1), 1–30. doi:10.18637/jss.v091.i01.
Ester, Martin, Kriegel, Hans-Peter, Sander, Jörg, Xu, Xiaowei, others (1996). “A density-based algorithm for discovering clusters in large spatial databases with noise.” In kdd, volume 96 number 34, 226–231.
Chapter in the mlr3book: https://mlr3book.mlr-org.com/chapters/chapter2/data_and_basic_modeling.html#sec-learners
Package mlr3extralearners for more learners.
as.data.table(mlr_learners) for a table of available Learners in the running session (depending on the loaded packages).
mlr3pipelines to combine learners with pre- and postprocessing steps.
Extension packages for additional task types:
mlr3proba for probabilistic supervised regression and survival analysis.
mlr3cluster for unsupervised clustering.
mlr3tuning for tuning of hyperparameters, mlr3tuningspaces for established default tuning spaces.
Other Learner:
mlr_learners_clust.MBatchKMeans,
mlr_learners_clust.SimpleKMeans,
mlr_learners_clust.agnes,
mlr_learners_clust.ap,
mlr_learners_clust.bico,
mlr_learners_clust.birch,
mlr_learners_clust.clara,
mlr_learners_clust.cmeans,
mlr_learners_clust.cobweb,
mlr_learners_clust.dbscan_fpc,
mlr_learners_clust.diana,
mlr_learners_clust.em,
mlr_learners_clust.fanny,
mlr_learners_clust.featureless,
mlr_learners_clust.ff,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.specc,
mlr_learners_clust.xmeans
# Define the Learner and set parameter values learner = lrn("clust.dbscan") print(learner)# Define the Learner and set parameter values learner = lrn("clust.dbscan") print(learner)
DBSCAN (density-based spatial clustering of applications with noise) clustering.
Calls fpc::dbscan() from package fpc.
This mlr3::Learner can be instantiated via the dictionary mlr3::mlr_learners or with the associated sugar function mlr3::lrn():
mlr_learners$get("clust.dbscan_fpc")
lrn("clust.dbscan_fpc")
Task type: “clust”
Predict Types: “partition”
Feature Types: “logical”, “integer”, “numeric”
Required Packages: mlr3, mlr3cluster, fpc
| Id | Type | Default | Levels | Range |
| eps | numeric | - | |
|
| MinPts | integer | 5 | |
|
| scale | logical | FALSE | TRUE, FALSE | - |
| method | character | hybrid | hybrid, raw, dist | - |
| seeds | logical | TRUE | TRUE, FALSE | - |
| showplot | untyped | FALSE | - | |
| countmode | untyped | NULL | - |
mlr3::Learner -> mlr3cluster::LearnerClust -> LearnerClustDBSCANfpc
new()
Creates a new instance of this R6 class.
LearnerClustDBSCANfpc$new()
clone()
The objects of this class are cloneable with this method.
LearnerClustDBSCANfpc$clone(deep = FALSE)
deepWhether to make a deep clone.
Ester, Martin, Kriegel, Hans-Peter, Sander, Jörg, Xu, Xiaowei, others (1996). “A density-based algorithm for discovering clusters in large spatial databases with noise.” In kdd, volume 96 number 34, 226–231.
Chapter in the mlr3book: https://mlr3book.mlr-org.com/chapters/chapter2/data_and_basic_modeling.html#sec-learners
Package mlr3extralearners for more learners.
as.data.table(mlr_learners) for a table of available Learners in the running session (depending on the loaded packages).
mlr3pipelines to combine learners with pre- and postprocessing steps.
Extension packages for additional task types:
mlr3proba for probabilistic supervised regression and survival analysis.
mlr3cluster for unsupervised clustering.
mlr3tuning for tuning of hyperparameters, mlr3tuningspaces for established default tuning spaces.
Other Learner:
mlr_learners_clust.MBatchKMeans,
mlr_learners_clust.SimpleKMeans,
mlr_learners_clust.agnes,
mlr_learners_clust.ap,
mlr_learners_clust.bico,
mlr_learners_clust.birch,
mlr_learners_clust.clara,
mlr_learners_clust.cmeans,
mlr_learners_clust.cobweb,
mlr_learners_clust.dbscan,
mlr_learners_clust.diana,
mlr_learners_clust.em,
mlr_learners_clust.fanny,
mlr_learners_clust.featureless,
mlr_learners_clust.ff,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.specc,
mlr_learners_clust.xmeans
# Define the Learner and set parameter values learner = lrn("clust.dbscan_fpc") print(learner)# Define the Learner and set parameter values learner = lrn("clust.dbscan_fpc") print(learner)
Divisive hierarchical clustering.
Calls cluster::diana() from package cluster.
The predict method uses stats::cutree() which cuts the tree resulting from
hierarchical clustering into specified number of groups (see parameter k).
The default value for k is 2.
This mlr3::Learner can be instantiated via the dictionary mlr3::mlr_learners or with the associated sugar function mlr3::lrn():
mlr_learners$get("clust.diana")
lrn("clust.diana")
Task type: “clust”
Predict Types: “partition”
Feature Types: “logical”, “integer”, “numeric”
Required Packages: mlr3, mlr3cluster, cluster
| Id | Type | Default | Levels | Range |
| metric | character | euclidean | euclidean, manhattan | - |
| stand | logical | FALSE | TRUE, FALSE | - |
| trace.lev | integer | 0 | |
|
| k | integer | 2 |
|
mlr3::Learner -> mlr3cluster::LearnerClust -> LearnerClustDiana
new()
Creates a new instance of this R6 class.
LearnerClustDiana$new()
clone()
The objects of this class are cloneable with this method.
LearnerClustDiana$clone(deep = FALSE)
deepWhether to make a deep clone.
Kaufman, Leonard, Rousseeuw, J P (2009). Finding groups in data: an introduction to cluster analysis. John Wiley & Sons.
Chapter in the mlr3book: https://mlr3book.mlr-org.com/chapters/chapter2/data_and_basic_modeling.html#sec-learners
Package mlr3extralearners for more learners.
as.data.table(mlr_learners) for a table of available Learners in the running session (depending on the loaded packages).
mlr3pipelines to combine learners with pre- and postprocessing steps.
Extension packages for additional task types:
mlr3proba for probabilistic supervised regression and survival analysis.
mlr3cluster for unsupervised clustering.
mlr3tuning for tuning of hyperparameters, mlr3tuningspaces for established default tuning spaces.
Other Learner:
mlr_learners_clust.MBatchKMeans,
mlr_learners_clust.SimpleKMeans,
mlr_learners_clust.agnes,
mlr_learners_clust.ap,
mlr_learners_clust.bico,
mlr_learners_clust.birch,
mlr_learners_clust.clara,
mlr_learners_clust.cmeans,
mlr_learners_clust.cobweb,
mlr_learners_clust.dbscan,
mlr_learners_clust.dbscan_fpc,
mlr_learners_clust.em,
mlr_learners_clust.fanny,
mlr_learners_clust.featureless,
mlr_learners_clust.ff,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.specc,
mlr_learners_clust.xmeans
# Define the Learner and set parameter values learner = lrn("clust.diana") print(learner) # Define a Task task = tsk("usarrests") # Train the learner on the task learner$train(task) # Print the model print(learner$model) # Make predictions for the task prediction = learner$predict(task) # Score the predictions prediction$score(task = task)# Define the Learner and set parameter values learner = lrn("clust.diana") print(learner) # Define a Task task = tsk("usarrests") # Train the learner on the task learner$train(task) # Print the model print(learner$model) # Make predictions for the task prediction = learner$predict(task) # Score the predictions prediction$score(task = task)
Expectation-Maximization clustering. Calls the EM Weka clusterer from package RWeka.
The predict method uses RWeka::predict.Weka_clusterer() to compute the
cluster memberships for new data.
The learner supports both partitional and fuzzy clustering.
This mlr3::Learner can be instantiated via the dictionary mlr3::mlr_learners or with the associated sugar function mlr3::lrn():
mlr_learners$get("clust.em")
lrn("clust.em")
Task type: “clust”
Predict Types: “partition”, “prob”
Feature Types: “logical”, “integer”, “numeric”
Required Packages: mlr3, mlr3cluster, RWeka
| Id | Type | Default | Levels | Range |
| I | integer | 100 | |
|
| ll_cv | numeric | 1e-06 | |
|
| ll_iter | numeric | 1e-06 | |
|
| M | numeric | 1e-06 | |
|
| max | integer | -1 | |
|
| N | integer | -1 | |
|
| num_slots | integer | 1 | |
|
| S | integer | 100 | |
|
| X | integer | 10 | |
|
| K | integer | 10 | |
|
| V | logical | FALSE | TRUE, FALSE | - |
| output_debug_info | logical | FALSE | TRUE, FALSE | - |
mlr3::Learner -> mlr3cluster::LearnerClust -> LearnerClustEM
new()
Creates a new instance of this R6 class.
LearnerClustEM$new()
clone()
The objects of this class are cloneable with this method.
LearnerClustEM$clone(deep = FALSE)
deepWhether to make a deep clone.
Witten, H I, Frank, Eibe (2002). “Data mining: practical machine learning tools and techniques with Java implementations.” Acm Sigmod Record, 31(1), 76–77.
Dempster, P A, Laird, M N, Rubin, B D (1977). “Maximum likelihood from incomplete data via the EM algorithm.” Journal of the royal statistical society: series B (methodological), 39(1), 1–22.
Chapter in the mlr3book: https://mlr3book.mlr-org.com/chapters/chapter2/data_and_basic_modeling.html#sec-learners
Package mlr3extralearners for more learners.
as.data.table(mlr_learners) for a table of available Learners in the running session (depending on the loaded packages).
mlr3pipelines to combine learners with pre- and postprocessing steps.
Extension packages for additional task types:
mlr3proba for probabilistic supervised regression and survival analysis.
mlr3cluster for unsupervised clustering.
mlr3tuning for tuning of hyperparameters, mlr3tuningspaces for established default tuning spaces.
Other Learner:
mlr_learners_clust.MBatchKMeans,
mlr_learners_clust.SimpleKMeans,
mlr_learners_clust.agnes,
mlr_learners_clust.ap,
mlr_learners_clust.bico,
mlr_learners_clust.birch,
mlr_learners_clust.clara,
mlr_learners_clust.cmeans,
mlr_learners_clust.cobweb,
mlr_learners_clust.dbscan,
mlr_learners_clust.dbscan_fpc,
mlr_learners_clust.diana,
mlr_learners_clust.fanny,
mlr_learners_clust.featureless,
mlr_learners_clust.ff,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.specc,
mlr_learners_clust.xmeans
# Define the Learner and set parameter values learner = lrn("clust.em") print(learner) # Define a Task task = tsk("usarrests") # Train the learner on the task learner$train(task) # Print the model print(learner$model) # Make predictions for the task prediction = learner$predict(task) # Score the predictions prediction$score(task = task)# Define the Learner and set parameter values learner = lrn("clust.em") print(learner) # Define a Task task = tsk("usarrests") # Train the learner on the task learner$train(task) # Print the model print(learner$model) # Make predictions for the task prediction = learner$predict(task) # Score the predictions prediction$score(task = task)
Fuzzy Analysis (FANNY) clustering.
Calls cluster::fanny() from package cluster.
The k parameter is set to 2 by default since cluster::fanny()
doesn't have a default value for the number of clusters.
The predict method copies cluster assignments and memberships
generated for train data. The predict does not work for new data.
This mlr3::Learner can be instantiated via the dictionary mlr3::mlr_learners or with the associated sugar function mlr3::lrn():
mlr_learners$get("clust.fanny")
lrn("clust.fanny")
Task type: “clust”
Predict Types: “partition”, “prob”
Feature Types: “logical”, “integer”, “numeric”
Required Packages: mlr3, mlr3cluster, cluster
| Id | Type | Default | Levels | Range |
| k | integer | - | |
|
| memb.exp | numeric | 2 | |
|
| metric | character | euclidean | euclidean, manhattan, SqEuclidean | - |
| stand | logical | FALSE | TRUE, FALSE | - |
| iniMem.p | untyped | NULL | - | |
| maxit | integer | 500 | |
|
| tol | numeric | 1e-15 | |
|
| trace.lev | integer | 0 |
|
mlr3::Learner -> mlr3cluster::LearnerClust -> LearnerClustFanny
new()
Creates a new instance of this R6 class.
LearnerClustFanny$new()
clone()
The objects of this class are cloneable with this method.
LearnerClustFanny$clone(deep = FALSE)
deepWhether to make a deep clone.
Kaufman, Leonard, Rousseeuw, J P (2009). Finding groups in data: an introduction to cluster analysis. John Wiley & Sons.
Chapter in the mlr3book: https://mlr3book.mlr-org.com/chapters/chapter2/data_and_basic_modeling.html#sec-learners
Package mlr3extralearners for more learners.
as.data.table(mlr_learners) for a table of available Learners in the running session (depending on the loaded packages).
mlr3pipelines to combine learners with pre- and postprocessing steps.
Extension packages for additional task types:
mlr3proba for probabilistic supervised regression and survival analysis.
mlr3cluster for unsupervised clustering.
mlr3tuning for tuning of hyperparameters, mlr3tuningspaces for established default tuning spaces.
Other Learner:
mlr_learners_clust.MBatchKMeans,
mlr_learners_clust.SimpleKMeans,
mlr_learners_clust.agnes,
mlr_learners_clust.ap,
mlr_learners_clust.bico,
mlr_learners_clust.birch,
mlr_learners_clust.clara,
mlr_learners_clust.cmeans,
mlr_learners_clust.cobweb,
mlr_learners_clust.dbscan,
mlr_learners_clust.dbscan_fpc,
mlr_learners_clust.diana,
mlr_learners_clust.em,
mlr_learners_clust.featureless,
mlr_learners_clust.ff,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.specc,
mlr_learners_clust.xmeans
# Define the Learner and set parameter values learner = lrn("clust.fanny") print(learner) # Define a Task task = tsk("usarrests") # Train the learner on the task learner$train(task) # Print the model print(learner$model) # Make predictions for the task prediction = learner$predict(task) # Score the predictions prediction$score(task = task)# Define the Learner and set parameter values learner = lrn("clust.fanny") print(learner) # Define a Task task = tsk("usarrests") # Train the learner on the task learner$train(task) # Print the model print(learner$model) # Make predictions for the task prediction = learner$predict(task) # Score the predictions prediction$score(task = task)
Featureless clustering.
Randomly (but evenly) assigns observations to num_clusters partitions
(default: 1 partition).
This mlr3::Learner can be instantiated via the dictionary mlr3::mlr_learners or with the associated sugar function mlr3::lrn():
mlr_learners$get("clust.featureless")
lrn("clust.featureless")
Task type: “clust”
Predict Types: “partition”, “prob”
Feature Types: “logical”, “integer”, “numeric”
Required Packages: mlr3, mlr3cluster
| Id | Type | Default | Range |
| num_clusters | integer | - |
|
mlr3::Learner -> mlr3cluster::LearnerClust -> LearnerClustFeatureless
new()
Creates a new instance of this R6 class.
LearnerClustFeatureless$new()
clone()
The objects of this class are cloneable with this method.
LearnerClustFeatureless$clone(deep = FALSE)
deepWhether to make a deep clone.
Chapter in the mlr3book: https://mlr3book.mlr-org.com/chapters/chapter2/data_and_basic_modeling.html#sec-learners
Package mlr3extralearners for more learners.
as.data.table(mlr_learners) for a table of available Learners in the running session (depending on the loaded packages).
mlr3pipelines to combine learners with pre- and postprocessing steps.
Extension packages for additional task types:
mlr3proba for probabilistic supervised regression and survival analysis.
mlr3cluster for unsupervised clustering.
mlr3tuning for tuning of hyperparameters, mlr3tuningspaces for established default tuning spaces.
Other Learner:
mlr_learners_clust.MBatchKMeans,
mlr_learners_clust.SimpleKMeans,
mlr_learners_clust.agnes,
mlr_learners_clust.ap,
mlr_learners_clust.bico,
mlr_learners_clust.birch,
mlr_learners_clust.clara,
mlr_learners_clust.cmeans,
mlr_learners_clust.cobweb,
mlr_learners_clust.dbscan,
mlr_learners_clust.dbscan_fpc,
mlr_learners_clust.diana,
mlr_learners_clust.em,
mlr_learners_clust.fanny,
mlr_learners_clust.ff,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.specc,
mlr_learners_clust.xmeans
# Define the Learner and set parameter values learner = lrn("clust.featureless") print(learner) # Define a Task task = tsk("usarrests") # Train the learner on the task learner$train(task) # Print the model print(learner$model) # Make predictions for the task prediction = learner$predict(task) # Score the predictions prediction$score(task = task)# Define the Learner and set parameter values learner = lrn("clust.featureless") print(learner) # Define a Task task = tsk("usarrests") # Train the learner on the task learner$train(task) # Print the model print(learner$model) # Make predictions for the task prediction = learner$predict(task) # Score the predictions prediction$score(task = task)
Farthest First clustering.
Calls RWeka::FarthestFirst() from package RWeka.
The predict method uses RWeka::predict.Weka_clusterer() to compute the
cluster memberships for new data.
This mlr3::Learner can be instantiated via the dictionary mlr3::mlr_learners or with the associated sugar function mlr3::lrn():
mlr_learners$get("clust.ff")
lrn("clust.ff")
Task type: “clust”
Predict Types: “partition”
Feature Types: “logical”, “integer”, “numeric”
Required Packages: mlr3, mlr3cluster, RWeka
| Id | Type | Default | Levels | Range |
| N | integer | 2 | |
|
| S | integer | 1 | |
|
| output_debug_info | logical | FALSE | TRUE, FALSE | - |
mlr3::Learner -> mlr3cluster::LearnerClust -> LearnerClustFarthestFirst
new()
Creates a new instance of this R6 class.
LearnerClustFarthestFirst$new()
clone()
The objects of this class are cloneable with this method.
LearnerClustFarthestFirst$clone(deep = FALSE)
deepWhether to make a deep clone.
Witten, H I, Frank, Eibe (2002). “Data mining: practical machine learning tools and techniques with Java implementations.” Acm Sigmod Record, 31(1), 76–77.
Hochbaum, S D, Shmoys, B D (1985). “A best possible heuristic for the k-center problem.” Mathematics of operations research, 10(2), 180–184.
Chapter in the mlr3book: https://mlr3book.mlr-org.com/chapters/chapter2/data_and_basic_modeling.html#sec-learners
Package mlr3extralearners for more learners.
as.data.table(mlr_learners) for a table of available Learners in the running session (depending on the loaded packages).
mlr3pipelines to combine learners with pre- and postprocessing steps.
Extension packages for additional task types:
mlr3proba for probabilistic supervised regression and survival analysis.
mlr3cluster for unsupervised clustering.
mlr3tuning for tuning of hyperparameters, mlr3tuningspaces for established default tuning spaces.
Other Learner:
mlr_learners_clust.MBatchKMeans,
mlr_learners_clust.SimpleKMeans,
mlr_learners_clust.agnes,
mlr_learners_clust.ap,
mlr_learners_clust.bico,
mlr_learners_clust.birch,
mlr_learners_clust.clara,
mlr_learners_clust.cmeans,
mlr_learners_clust.cobweb,
mlr_learners_clust.dbscan,
mlr_learners_clust.dbscan_fpc,
mlr_learners_clust.diana,
mlr_learners_clust.em,
mlr_learners_clust.fanny,
mlr_learners_clust.featureless,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.specc,
mlr_learners_clust.xmeans
# Define the Learner and set parameter values learner = lrn("clust.ff") print(learner) # Define a Task task = tsk("usarrests") # Train the learner on the task learner$train(task) # Print the model print(learner$model) # Make predictions for the task prediction = learner$predict(task) # Score the predictions prediction$score(task = task)# Define the Learner and set parameter values learner = lrn("clust.ff") print(learner) # Define a Task task = tsk("usarrests") # Train the learner on the task learner$train(task) # Print the model print(learner$model) # Make predictions for the task prediction = learner$predict(task) # Score the predictions prediction$score(task = task)
Agglomerative hierarchical clustering.
Calls stats::hclust() from package stats.
Distance calculation is done by stats::dist().
This mlr3::Learner can be instantiated via the dictionary mlr3::mlr_learners or with the associated sugar function mlr3::lrn():
mlr_learners$get("clust.hclust")
lrn("clust.hclust")
Task type: “clust”
Predict Types: “partition”
Feature Types: “logical”, “integer”, “numeric”
Required Packages: mlr3, mlr3cluster, 'stats'
| Id | Type | Default | Levels | Range |
| method | character | complete | ward.D, ward.D2, single, complete, average, mcquitty, median, centroid | - |
| members | untyped | NULL | - | |
| distmethod | character | euclidean | euclidean, maximum, manhattan, canberra, binary, minkowski | - |
| diag | logical | FALSE | TRUE, FALSE | - |
| upper | logical | FALSE | TRUE, FALSE | - |
| p | numeric | 2 | |
|
| k | integer | NULL |
|
mlr3::Learner -> mlr3cluster::LearnerClust -> LearnerClustHclust
new()
Creates a new instance of this R6 class.
LearnerClustHclust$new()
clone()
The objects of this class are cloneable with this method.
LearnerClustHclust$clone(deep = FALSE)
deepWhether to make a deep clone.
Becker, A R, Chambers, M J, Wilks, R A (1988). The New S Language. Wadsworth & Brooks/Cole.
Everitt, S B (1974). Cluster Analysis. Heinemann Educational Books.
Hartigan, A J (1975). Clustering Algorithms. John Wiley & Sons.
Sneath, HA P, Sokal, R R (1973). Numerical Taxonomy. Freeman.
Anderberg, R M (1973). Cluster Analysis for Applications. Academic Press.
Gordon, David A (1999). Classification, 2 edition. Chapman and Hall / CRC.
Murtagh, Fionn (1985). “Multidimensional Clustering Algorithms.” In COMPSTAT Lectures 4. Physica-Verlag.
McQuitty, L L (1966). “Similarity Analysis by Reciprocal Pairs for Discrete and Continuous Data.” Educational and Psychological Measurement, 26(4), 825–831. doi:10.1177/001316446602600402.
Legendre, Pierre, Legendre, Louis (2012). Numerical Ecology, 3 edition. Elsevier Science BV.
Murtagh, Fionn, Legendre, Pierre (2014). “Ward's Hierarchical Agglomerative Clustering Method: Which Algorithms Implement Ward's Criterion?” Journal of Classification, 31, 274–295. doi:10.1007/s00357-014-9161-z.
Chapter in the mlr3book: https://mlr3book.mlr-org.com/chapters/chapter2/data_and_basic_modeling.html#sec-learners
Package mlr3extralearners for more learners.
as.data.table(mlr_learners) for a table of available Learners in the running session (depending on the loaded packages).
mlr3pipelines to combine learners with pre- and postprocessing steps.
Extension packages for additional task types:
mlr3proba for probabilistic supervised regression and survival analysis.
mlr3cluster for unsupervised clustering.
mlr3tuning for tuning of hyperparameters, mlr3tuningspaces for established default tuning spaces.
Other Learner:
mlr_learners_clust.MBatchKMeans,
mlr_learners_clust.SimpleKMeans,
mlr_learners_clust.agnes,
mlr_learners_clust.ap,
mlr_learners_clust.bico,
mlr_learners_clust.birch,
mlr_learners_clust.clara,
mlr_learners_clust.cmeans,
mlr_learners_clust.cobweb,
mlr_learners_clust.dbscan,
mlr_learners_clust.dbscan_fpc,
mlr_learners_clust.diana,
mlr_learners_clust.em,
mlr_learners_clust.fanny,
mlr_learners_clust.featureless,
mlr_learners_clust.ff,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.specc,
mlr_learners_clust.xmeans
# Define the Learner and set parameter values learner = lrn("clust.hclust") print(learner) # Define a Task task = tsk("usarrests") # Train the learner on the task learner$train(task) # Print the model print(learner$model) # Make predictions for the task prediction = learner$predict(task) # Score the predictions prediction$score(task = task)# Define the Learner and set parameter values learner = lrn("clust.hclust") print(learner) # Define a Task task = tsk("usarrests") # Train the learner on the task learner$train(task) # Print the model print(learner$model) # Make predictions for the task prediction = learner$predict(task) # Score the predictions prediction$score(task = task)
HDBSCAN (hierarchical DBSCAN) clustering.
Calls dbscan::hdbscan() from package dbscan.
This mlr3::Learner can be instantiated via the dictionary mlr3::mlr_learners or with the associated sugar function mlr3::lrn():
mlr_learners$get("clust.hdbscan")
lrn("clust.hdbscan")
Task type: “clust”
Predict Types: “partition”
Feature Types: “logical”, “integer”, “numeric”
Required Packages: mlr3, mlr3cluster, dbscan
| Id | Type | Default | Levels | Range |
| minPts | integer | - | |
|
| cluster_selection_epsilon | numeric | 0 | |
|
| gen_hdbscan_tree | logical | FALSE | TRUE, FALSE | - |
| gen_simplified_tree | logical | FALSE | TRUE, FALSE | - |
| verbose | logical | FALSE | TRUE, FALSE | - |
mlr3::Learner -> mlr3cluster::LearnerClust -> LearnerClustHDBSCAN
new()
Creates a new instance of this R6 class.
LearnerClustHDBSCAN$new()
clone()
The objects of this class are cloneable with this method.
LearnerClustHDBSCAN$clone(deep = FALSE)
deepWhether to make a deep clone.
Hahsler M, Piekenbrock M, Doran D (2019). “dbscan: Fast Density-Based Clustering with R.” Journal of Statistical Software, 91(1), 1–30. doi:10.18637/jss.v091.i01.
Campello, JGB R, Moulavi, Davoud, Sander, Jörg (2013). “Density-based clustering based on hierarchical density estimates.” In Pacific-Asia conference on knowledge discovery and data mining, 160–172. Springer.
Chapter in the mlr3book: https://mlr3book.mlr-org.com/chapters/chapter2/data_and_basic_modeling.html#sec-learners
Package mlr3extralearners for more learners.
as.data.table(mlr_learners) for a table of available Learners in the running session (depending on the loaded packages).
mlr3pipelines to combine learners with pre- and postprocessing steps.
Extension packages for additional task types:
mlr3proba for probabilistic supervised regression and survival analysis.
mlr3cluster for unsupervised clustering.
mlr3tuning for tuning of hyperparameters, mlr3tuningspaces for established default tuning spaces.
Other Learner:
mlr_learners_clust.MBatchKMeans,
mlr_learners_clust.SimpleKMeans,
mlr_learners_clust.agnes,
mlr_learners_clust.ap,
mlr_learners_clust.bico,
mlr_learners_clust.birch,
mlr_learners_clust.clara,
mlr_learners_clust.cmeans,
mlr_learners_clust.cobweb,
mlr_learners_clust.dbscan,
mlr_learners_clust.dbscan_fpc,
mlr_learners_clust.diana,
mlr_learners_clust.em,
mlr_learners_clust.fanny,
mlr_learners_clust.featureless,
mlr_learners_clust.ff,
mlr_learners_clust.hclust,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.specc,
mlr_learners_clust.xmeans
# Define the Learner and set parameter values learner = lrn("clust.hdbscan") print(learner) # Define a Task task = tsk("usarrests") # Train the learner on the task learner$train(task) # Print the model print(learner$model) # Make predictions for the task prediction = learner$predict(task) # Score the predictions prediction$score(task = task)# Define the Learner and set parameter values learner = lrn("clust.hdbscan") print(learner) # Define a Task task = tsk("usarrests") # Train the learner on the task learner$train(task) # Print the model print(learner$model) # Make predictions for the task prediction = learner$predict(task) # Score the predictions prediction$score(task = task)
Kernel k-means clustering.
Calls kernlab::kkmeans() from package kernlab.
The centers parameter is set to 2 by default since kernlab::kkmeans()
doesn't have a default value for the number of clusters.
Kernel parameters have to be passed directly and not by using the kpar list in kernlab::kkmeans().
The predict method finds the nearest center in kernel distance to
assign clusters for new data points.
This mlr3::Learner can be instantiated via the dictionary mlr3::mlr_learners or with the associated sugar function mlr3::lrn():
mlr_learners$get("clust.kkmeans")
lrn("clust.kkmeans")
Task type: “clust”
Predict Types: “partition”
Feature Types: “logical”, “integer”, “numeric”
Required Packages: mlr3, mlr3cluster, kernlab
| Id | Type | Default | Levels | Range |
| centers | untyped | - | - | |
| kernel | character | rbfdot | rbfdot, polydot, vanilladot, tanhdot, laplacedot, besseldot, anovadot, splinedot | - |
| sigma | numeric | - | |
|
| degree | integer | 3 | |
|
| scale | numeric | 1 | |
|
| offset | numeric | 1 | |
|
| order | integer | 1 | |
|
| alg | character | kkmeans | kkmeans, kerninghan | - |
| p | numeric | 1 |
|
mlr3::Learner -> mlr3cluster::LearnerClust -> LearnerClustKKMeans
new()
Creates a new instance of this R6 class.
LearnerClustKKMeans$new()
clone()
The objects of this class are cloneable with this method.
LearnerClustKKMeans$clone(deep = FALSE)
deepWhether to make a deep clone.
Karatzoglou, Alexandros, Smola, Alexandros, Hornik, Kurt, Zeileis, Achim (2004). “kernlab-an S4 package for kernel methods in R.” Journal of statistical software, 11, 1–20.
Dhillon, S I, Guan, Yuqiang, Kulis, Brian (2004). A unified view of kernel k-means, spectral clustering and graph cuts. Citeseer.
Chapter in the mlr3book: https://mlr3book.mlr-org.com/chapters/chapter2/data_and_basic_modeling.html#sec-learners
Package mlr3extralearners for more learners.
as.data.table(mlr_learners) for a table of available Learners in the running session (depending on the loaded packages).
mlr3pipelines to combine learners with pre- and postprocessing steps.
Extension packages for additional task types:
mlr3proba for probabilistic supervised regression and survival analysis.
mlr3cluster for unsupervised clustering.
mlr3tuning for tuning of hyperparameters, mlr3tuningspaces for established default tuning spaces.
Other Learner:
mlr_learners_clust.MBatchKMeans,
mlr_learners_clust.SimpleKMeans,
mlr_learners_clust.agnes,
mlr_learners_clust.ap,
mlr_learners_clust.bico,
mlr_learners_clust.birch,
mlr_learners_clust.clara,
mlr_learners_clust.cmeans,
mlr_learners_clust.cobweb,
mlr_learners_clust.dbscan,
mlr_learners_clust.dbscan_fpc,
mlr_learners_clust.diana,
mlr_learners_clust.em,
mlr_learners_clust.fanny,
mlr_learners_clust.featureless,
mlr_learners_clust.ff,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kmeans,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.specc,
mlr_learners_clust.xmeans
# Define the Learner and set parameter values learner = lrn("clust.kkmeans") print(learner) # Define a Task task = tsk("usarrests") # Train the learner on the task learner$train(task) # Print the model print(learner$model) # Make predictions for the task prediction = learner$predict(task) # Score the predictions prediction$score(task = task)# Define the Learner and set parameter values learner = lrn("clust.kkmeans") print(learner) # Define a Task task = tsk("usarrests") # Train the learner on the task learner$train(task) # Print the model print(learner$model) # Make predictions for the task prediction = learner$predict(task) # Score the predictions prediction$score(task = task)
K-means clustering.
Calls stats::kmeans() from package stats.
The centers parameter is set to 2 by default since stats::kmeans()
doesn't have a default value for the number of clusters.
The predict method uses clue::cl_predict() to compute the
cluster memberships for new data.
This mlr3::Learner can be instantiated via the dictionary mlr3::mlr_learners or with the associated sugar function mlr3::lrn():
mlr_learners$get("clust.kmeans")
lrn("clust.kmeans")
Task type: “clust”
Predict Types: “partition”
Feature Types: “logical”, “integer”, “numeric”
Required Packages: mlr3, mlr3cluster, 'stats', clue
| Id | Type | Default | Levels | Range |
| centers | untyped | - | - | |
| iter.max | integer | 10 | |
|
| algorithm | character | Hartigan-Wong | Hartigan-Wong, Lloyd, Forgy, MacQueen | - |
| nstart | integer | 1 | |
|
| trace | logical | FALSE | TRUE, FALSE | - |
mlr3::Learner -> mlr3cluster::LearnerClust -> LearnerClustKMeans
new()
Creates a new instance of this R6 class.
LearnerClustKMeans$new()
clone()
The objects of this class are cloneable with this method.
LearnerClustKMeans$clone(deep = FALSE)
deepWhether to make a deep clone.
Forgy, W E (1965). “Cluster analysis of multivariate data: efficiency versus interpretability of classifications.” Biometrics, 21, 768–769.
Hartigan, A J, Wong, A M (1979). “Algorithm AS 136: A K-means clustering algorithm.” Journal of the Royal Statistical Society. Series C (Applied Statistics), 28(1), 100–108. doi:10.2307/2346830.
Lloyd, P S (1982). “Least squares quantization in PCM.” IEEE Transactions on Information Theory, 28(2), 129–137.
MacQueen, James (1967). “Some methods for classification and analysis of multivariate observations.” In Proceedings of the Fifth Berkeley Symposium on Mathematical Statistics and Probability, volume 1, 281–297.
Chapter in the mlr3book: https://mlr3book.mlr-org.com/chapters/chapter2/data_and_basic_modeling.html#sec-learners
Package mlr3extralearners for more learners.
as.data.table(mlr_learners) for a table of available Learners in the running session (depending on the loaded packages).
mlr3pipelines to combine learners with pre- and postprocessing steps.
Extension packages for additional task types:
mlr3proba for probabilistic supervised regression and survival analysis.
mlr3cluster for unsupervised clustering.
mlr3tuning for tuning of hyperparameters, mlr3tuningspaces for established default tuning spaces.
Other Learner:
mlr_learners_clust.MBatchKMeans,
mlr_learners_clust.SimpleKMeans,
mlr_learners_clust.agnes,
mlr_learners_clust.ap,
mlr_learners_clust.bico,
mlr_learners_clust.birch,
mlr_learners_clust.clara,
mlr_learners_clust.cmeans,
mlr_learners_clust.cobweb,
mlr_learners_clust.dbscan,
mlr_learners_clust.dbscan_fpc,
mlr_learners_clust.diana,
mlr_learners_clust.em,
mlr_learners_clust.fanny,
mlr_learners_clust.featureless,
mlr_learners_clust.ff,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.specc,
mlr_learners_clust.xmeans
# Define the Learner and set parameter values learner = lrn("clust.kmeans") print(learner) # Define a Task task = tsk("usarrests") # Train the learner on the task learner$train(task) # Print the model print(learner$model) # Make predictions for the task prediction = learner$predict(task) # Score the predictions prediction$score(task = task)# Define the Learner and set parameter values learner = lrn("clust.kmeans") print(learner) # Define a Task task = tsk("usarrests") # Train the learner on the task learner$train(task) # Print the model print(learner$model) # Make predictions for the task prediction = learner$predict(task) # Score the predictions prediction$score(task = task)
K-prototypes clustering for mixed-type data.
Calls clustMixType::kproto() from package clustMixType.
The k parameter is set to 2 by default since clustMixType::kproto()
doesn't have a default value for the number of clusters.
This mlr3::Learner can be instantiated via the dictionary mlr3::mlr_learners or with the associated sugar function mlr3::lrn():
mlr_learners$get("clust.kproto")
lrn("clust.kproto")
Task type: “clust”
Predict Types: “partition”
Feature Types: “logical”, “integer”, “numeric”, “factor”, “ordered”
Required Packages: mlr3, mlr3cluster, clustMixType
| Id | Type | Default | Levels | Range |
| k | untyped | - | - | |
| lambda | untyped | NULL | - | |
| type | character | huang | huang, gower | - |
| iter.max | integer | 100 | |
|
| nstart | integer | 1 | |
|
| na.rm | character | yes | yes, no, imp.internal, imp.onestep | - |
| verbose | logical | TRUE | TRUE, FALSE | - |
| init | character | NULL | nbh.dens, sel.cen, nstart.m | - |
| p_nstart.m | numeric | 0.9 |
|
mlr3::Learner -> mlr3cluster::LearnerClust -> LearnerClustKProto
new()
Creates a new instance of this R6 class.
LearnerClustKProto$new()
clone()
The objects of this class are cloneable with this method.
LearnerClustKProto$clone(deep = FALSE)
deepWhether to make a deep clone.
Huang, Zhexue (1998). “Extensions to the k-Means Algorithm for Clustering Large Data Sets with Categorical Values.” Data Mining and Knowledge Discovery, 2(3), 283–304.
Chapter in the mlr3book: https://mlr3book.mlr-org.com/chapters/chapter2/data_and_basic_modeling.html#sec-learners
Package mlr3extralearners for more learners.
as.data.table(mlr_learners) for a table of available Learners in the running session (depending on the loaded packages).
mlr3pipelines to combine learners with pre- and postprocessing steps.
Extension packages for additional task types:
mlr3proba for probabilistic supervised regression and survival analysis.
mlr3cluster for unsupervised clustering.
mlr3tuning for tuning of hyperparameters, mlr3tuningspaces for established default tuning spaces.
Other Learner:
mlr_learners_clust.MBatchKMeans,
mlr_learners_clust.SimpleKMeans,
mlr_learners_clust.agnes,
mlr_learners_clust.ap,
mlr_learners_clust.bico,
mlr_learners_clust.birch,
mlr_learners_clust.clara,
mlr_learners_clust.cmeans,
mlr_learners_clust.cobweb,
mlr_learners_clust.dbscan,
mlr_learners_clust.dbscan_fpc,
mlr_learners_clust.diana,
mlr_learners_clust.em,
mlr_learners_clust.fanny,
mlr_learners_clust.featureless,
mlr_learners_clust.ff,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.specc,
mlr_learners_clust.xmeans
# Define the Learner and set parameter values learner = lrn("clust.kproto") print(learner) # Define a mixed-type Task (kproto requires at least one factor variable) data = data.frame( x1 = c(1, 2, 10, 11, 1, 2, 10, 11), x2 = factor(c("a", "a", "b", "b", "a", "a", "b", "b")) ) task = as_task_clust(data) # Train the learner on the task learner$train(task) # Print the model print(learner$model) # Make predictions for the task prediction = learner$predict(task) # Score the predictions prediction$score(task = task)# Define the Learner and set parameter values learner = lrn("clust.kproto") print(learner) # Define a mixed-type Task (kproto requires at least one factor variable) data = data.frame( x1 = c(1, 2, 10, 11, 1, 2, 10, 11), x2 = factor(c("a", "a", "b", "b", "a", "a", "b", "b")) ) task = as_task_clust(data) # Train the learner on the task learner$train(task) # Print the model print(learner$model) # Make predictions for the task prediction = learner$predict(task) # Score the predictions prediction$score(task = task)
Mini-batch k-means clustering.
Calls ClusterR::MiniBatchKmeans() from package ClusterR.
The clusters parameter is set to 2 by default since ClusterR::MiniBatchKmeans()
doesn't have a default value for the number of clusters.
The predict method uses ClusterR::predict_MBatchKMeans() to compute the
cluster memberships for new data.
The learner supports both partitional and fuzzy clustering.
This mlr3::Learner can be instantiated via the dictionary mlr3::mlr_learners or with the associated sugar function mlr3::lrn():
mlr_learners$get("clust.MBatchKMeans")
lrn("clust.MBatchKMeans")
Task type: “clust”
Predict Types: “partition”, “prob”
Feature Types: “logical”, “integer”, “numeric”
Required Packages: mlr3, mlr3cluster, ClusterR
| Id | Type | Default | Levels | Range |
| clusters | integer | 2 | |
|
| batch_size | integer | 10 | |
|
| num_init | integer | 1 | |
|
| max_iters | integer | 100 | |
|
| init_fraction | numeric | 1 | |
|
| initializer | character | kmeans++ | optimal_init, quantile_init, kmeans++, random | - |
| early_stop_iter | integer | 10 | |
|
| verbose | logical | FALSE | TRUE, FALSE | - |
| CENTROIDS | untyped | NULL | - | |
| tol | numeric | 1e-04 | |
|
| tol_optimal_init | numeric | 0.3 | |
|
| seed | integer | 1 |
|
mlr3::Learner -> mlr3cluster::LearnerClust -> LearnerClustMiniBatchKMeans
new()
Creates a new instance of this R6 class.
LearnerClustMiniBatchKMeans$new()
clone()
The objects of this class are cloneable with this method.
LearnerClustMiniBatchKMeans$clone(deep = FALSE)
deepWhether to make a deep clone.
Sculley, David (2010). “Web-scale k-means clustering.” In Proceedings of the 19th international conference on World wide web, 1177–1178.
Chapter in the mlr3book: https://mlr3book.mlr-org.com/chapters/chapter2/data_and_basic_modeling.html#sec-learners
Package mlr3extralearners for more learners.
as.data.table(mlr_learners) for a table of available Learners in the running session (depending on the loaded packages).
mlr3pipelines to combine learners with pre- and postprocessing steps.
Extension packages for additional task types:
mlr3proba for probabilistic supervised regression and survival analysis.
mlr3cluster for unsupervised clustering.
mlr3tuning for tuning of hyperparameters, mlr3tuningspaces for established default tuning spaces.
Other Learner:
mlr_learners_clust.SimpleKMeans,
mlr_learners_clust.agnes,
mlr_learners_clust.ap,
mlr_learners_clust.bico,
mlr_learners_clust.birch,
mlr_learners_clust.clara,
mlr_learners_clust.cmeans,
mlr_learners_clust.cobweb,
mlr_learners_clust.dbscan,
mlr_learners_clust.dbscan_fpc,
mlr_learners_clust.diana,
mlr_learners_clust.em,
mlr_learners_clust.fanny,
mlr_learners_clust.featureless,
mlr_learners_clust.ff,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.specc,
mlr_learners_clust.xmeans
# Define the Learner and set parameter values learner = lrn("clust.MBatchKMeans") print(learner) # Define a Task task = tsk("usarrests") # Train the learner on the task learner$train(task) # Print the model print(learner$model) # Make predictions for the task prediction = learner$predict(task) # Score the predictions prediction$score(task = task)# Define the Learner and set parameter values learner = lrn("clust.MBatchKMeans") print(learner) # Define a Task task = tsk("usarrests") # Train the learner on the task learner$train(task) # Print the model print(learner$model) # Make predictions for the task prediction = learner$predict(task) # Score the predictions prediction$score(task = task)
Gaussian mixture model-based clustering.
Calls mclust::Mclust() from package mclust.
The predict method uses mclust::predict.Mclust() to compute the
cluster memberships for new data.
This mlr3::Learner can be instantiated via the dictionary mlr3::mlr_learners or with the associated sugar function mlr3::lrn():
mlr_learners$get("clust.mclust")
lrn("clust.mclust")
Task type: “clust”
Predict Types: “partition”, “prob”
Feature Types: “logical”, “integer”, “numeric”
Required Packages: mlr3, mlr3cluster, mclust
| Id | Type | Default | Levels |
| G | untyped | 1:9 | |
| modelNames | untyped | - | |
| prior | untyped | - | |
| control | untyped | - | |
| initialization | untyped | - | |
| warn | logical | FALSE | TRUE, FALSE |
| x | untyped | - | |
| verbose | logical | FALSE | TRUE, FALSE |
mlr3::Learner -> mlr3cluster::LearnerClust -> LearnerClustMclust
new()
Creates a new instance of this R6 class.
LearnerClustMclust$new()
clone()
The objects of this class are cloneable with this method.
LearnerClustMclust$clone(deep = FALSE)
deepWhether to make a deep clone.
Scrucca, Luca, Fop, Michael, Murphy, Brendan T, Raftery, E A (2016). “mclust 5: clustering, classification and density estimation using Gaussian finite mixture models.” The R journal, 8(1), 289.
Fraley, Chris, Raftery, E A (2002). “Model-based clustering, discriminant analysis, and density estimation.” Journal of the American statistical Association, 97(458), 611–631.
Chapter in the mlr3book: https://mlr3book.mlr-org.com/chapters/chapter2/data_and_basic_modeling.html#sec-learners
Package mlr3extralearners for more learners.
as.data.table(mlr_learners) for a table of available Learners in the running session (depending on the loaded packages).
mlr3pipelines to combine learners with pre- and postprocessing steps.
Extension packages for additional task types:
mlr3proba for probabilistic supervised regression and survival analysis.
mlr3cluster for unsupervised clustering.
mlr3tuning for tuning of hyperparameters, mlr3tuningspaces for established default tuning spaces.
Other Learner:
mlr_learners_clust.MBatchKMeans,
mlr_learners_clust.SimpleKMeans,
mlr_learners_clust.agnes,
mlr_learners_clust.ap,
mlr_learners_clust.bico,
mlr_learners_clust.birch,
mlr_learners_clust.clara,
mlr_learners_clust.cmeans,
mlr_learners_clust.cobweb,
mlr_learners_clust.dbscan,
mlr_learners_clust.dbscan_fpc,
mlr_learners_clust.diana,
mlr_learners_clust.em,
mlr_learners_clust.fanny,
mlr_learners_clust.featureless,
mlr_learners_clust.ff,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kproto,
mlr_learners_clust.meanshift,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.specc,
mlr_learners_clust.xmeans
# Define the Learner and set parameter values learner = lrn("clust.mclust") print(learner) # Define a Task task = tsk("usarrests") # Train the learner on the task learner$train(task) # Print the model print(learner$model) # Make predictions for the task prediction = learner$predict(task) # Score the predictions prediction$score(task = task)# Define the Learner and set parameter values learner = lrn("clust.mclust") print(learner) # Define a Task task = tsk("usarrests") # Train the learner on the task learner$train(task) # Print the model print(learner$model) # Make predictions for the task prediction = learner$predict(task) # Score the predictions prediction$score(task = task)
Mean shift clustering.
Calls LPCM::ms() from package LPCM.
There is no predict method for LPCM::ms(), so the method
returns cluster labels for the training data.
This mlr3::Learner can be instantiated via the dictionary mlr3::mlr_learners or with the associated sugar function mlr3::lrn():
mlr_learners$get("clust.meanshift")
lrn("clust.meanshift")
Task type: “clust”
Predict Types: “partition”
Feature Types: “logical”, “integer”, “numeric”
Required Packages: mlr3, mlr3cluster, LPCM
| Id | Type | Default | Levels | Range |
| h | untyped | - | - | |
| subset | untyped | - | - | |
| thr | numeric | 0.01 | |
|
| scaled | integer | 1 | |
|
| iter | integer | 200 | |
|
| plot | logical | TRUE | TRUE, FALSE | - |
mlr3::Learner -> mlr3cluster::LearnerClust -> LearnerClustMeanShift
new()
Creates a new instance of this R6 class.
LearnerClustMeanShift$new()
clone()
The objects of this class are cloneable with this method.
LearnerClustMeanShift$clone(deep = FALSE)
deepWhether to make a deep clone.
Cheng, Yizong (1995). “Mean shift, mode seeking, and clustering.” IEEE transactions on pattern analysis and machine intelligence, 17(8), 790–799.
Chapter in the mlr3book: https://mlr3book.mlr-org.com/chapters/chapter2/data_and_basic_modeling.html#sec-learners
Package mlr3extralearners for more learners.
as.data.table(mlr_learners) for a table of available Learners in the running session (depending on the loaded packages).
mlr3pipelines to combine learners with pre- and postprocessing steps.
Extension packages for additional task types:
mlr3proba for probabilistic supervised regression and survival analysis.
mlr3cluster for unsupervised clustering.
mlr3tuning for tuning of hyperparameters, mlr3tuningspaces for established default tuning spaces.
Other Learner:
mlr_learners_clust.MBatchKMeans,
mlr_learners_clust.SimpleKMeans,
mlr_learners_clust.agnes,
mlr_learners_clust.ap,
mlr_learners_clust.bico,
mlr_learners_clust.birch,
mlr_learners_clust.clara,
mlr_learners_clust.cmeans,
mlr_learners_clust.cobweb,
mlr_learners_clust.dbscan,
mlr_learners_clust.dbscan_fpc,
mlr_learners_clust.diana,
mlr_learners_clust.em,
mlr_learners_clust.fanny,
mlr_learners_clust.featureless,
mlr_learners_clust.ff,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.specc,
mlr_learners_clust.xmeans
# Define the Learner and set parameter values learner = lrn("clust.meanshift") print(learner) # Define a Task task = tsk("usarrests") # Train the learner on the task learner$train(task) # Print the model print(learner$model) # Make predictions for the task prediction = learner$predict(task) # Score the predictions prediction$score(task = task)# Define the Learner and set parameter values learner = lrn("clust.meanshift") print(learner) # Define a Task task = tsk("usarrests") # Train the learner on the task learner$train(task) # Print the model print(learner$model) # Make predictions for the task prediction = learner$predict(task) # Score the predictions prediction$score(task = task)
OPTICS (ordering points to identify the clustering structure) clustering.
Calls dbscan::optics() from package dbscan.
This mlr3::Learner can be instantiated via the dictionary mlr3::mlr_learners or with the associated sugar function mlr3::lrn():
mlr_learners$get("clust.optics")
lrn("clust.optics")
Task type: “clust”
Predict Types: “partition”
Feature Types: “logical”, “integer”, “numeric”
Required Packages: mlr3, mlr3cluster, dbscan
| Id | Type | Default | Levels | Range |
| eps | numeric | NULL | |
|
| minPts | integer | 5 | |
|
| search | character | kdtree | kdtree, linear, dist | - |
| bucketSize | integer | 10 | |
|
| splitRule | character | SUGGEST | STD, MIDPT, FAIR, SL_MIDPT, SL_FAIR, SUGGEST | - |
| approx | numeric | 0 | |
|
| eps_cl | numeric | - |
|
mlr3::Learner -> mlr3cluster::LearnerClust -> LearnerClustOPTICS
new()
Creates a new instance of this R6 class.
LearnerClustOPTICS$new()
clone()
The objects of this class are cloneable with this method.
LearnerClustOPTICS$clone(deep = FALSE)
deepWhether to make a deep clone.
Hahsler M, Piekenbrock M, Doran D (2019). “dbscan: Fast Density-Based Clustering with R.” Journal of Statistical Software, 91(1), 1–30. doi:10.18637/jss.v091.i01.
Ankerst, Mihael, Breunig, M M, Kriegel, Hans-Peter, Sander, Jörg (1999). “OPTICS: Ordering points to identify the clustering structure.” ACM Sigmod record, 28(2), 49–60.
Chapter in the mlr3book: https://mlr3book.mlr-org.com/chapters/chapter2/data_and_basic_modeling.html#sec-learners
Package mlr3extralearners for more learners.
as.data.table(mlr_learners) for a table of available Learners in the running session (depending on the loaded packages).
mlr3pipelines to combine learners with pre- and postprocessing steps.
Extension packages for additional task types:
mlr3proba for probabilistic supervised regression and survival analysis.
mlr3cluster for unsupervised clustering.
mlr3tuning for tuning of hyperparameters, mlr3tuningspaces for established default tuning spaces.
Other Learner:
mlr_learners_clust.MBatchKMeans,
mlr_learners_clust.SimpleKMeans,
mlr_learners_clust.agnes,
mlr_learners_clust.ap,
mlr_learners_clust.bico,
mlr_learners_clust.birch,
mlr_learners_clust.clara,
mlr_learners_clust.cmeans,
mlr_learners_clust.cobweb,
mlr_learners_clust.dbscan,
mlr_learners_clust.dbscan_fpc,
mlr_learners_clust.diana,
mlr_learners_clust.em,
mlr_learners_clust.fanny,
mlr_learners_clust.featureless,
mlr_learners_clust.ff,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.specc,
mlr_learners_clust.xmeans
# Define the Learner and set parameter values learner = lrn("clust.optics") print(learner)# Define the Learner and set parameter values learner = lrn("clust.optics") print(learner)
Partitioning Around Medoids (PAM) clustering.
Calls cluster::pam() from package cluster.
The k parameter is set to 2 by default since cluster::pam()
doesn't have a default value for the number of clusters.
The predict method uses clue::cl_predict() to compute the
cluster memberships for new data.
This mlr3::Learner can be instantiated via the dictionary mlr3::mlr_learners or with the associated sugar function mlr3::lrn():
mlr_learners$get("clust.pam")
lrn("clust.pam")
Task type: “clust”
Predict Types: “partition”
Feature Types: “logical”, “integer”, “numeric”
Required Packages: mlr3, mlr3cluster, cluster, clue
| Id | Type | Default | Levels | Range |
| k | integer | - | |
|
| metric | character | euclidean | euclidean, manhattan | - |
| medoids | untyped | NULL | - | |
| nstart | integer | 1 | |
|
| stand | logical | FALSE | TRUE, FALSE | - |
| do.swap | logical | TRUE | TRUE, FALSE | - |
| pamonce | untyped | FALSE | - | |
| variant | character | original | original, o_1, o_2, f_3, f_4, f_5, faster | - |
| trace.lev | integer | 0 |
|
mlr3::Learner -> mlr3cluster::LearnerClust -> LearnerClustPAM
new()
Creates a new instance of this R6 class.
LearnerClustPAM$new()
clone()
The objects of this class are cloneable with this method.
LearnerClustPAM$clone(deep = FALSE)
deepWhether to make a deep clone.
Reynolds, P A, Richards, Graeme, de la Iglesia, Beatriz, Rayward-Smith, J V (2006). “Clustering rules: a comparison of partitioning and hierarchical clustering algorithms.” Journal of Mathematical Modelling and Algorithms, 5, 475–504.
Schubert, Erich, Rousseeuw, J P (2019). “Faster k-medoids clustering: improving the PAM, CLARA, and CLARANS algorithms.” In Similarity Search and Applications: 12th International Conference, SISAP 2019, Newark, NJ, USA, October 2–4, 2019, Proceedings 12, 171–187. Springer.
Chapter in the mlr3book: https://mlr3book.mlr-org.com/chapters/chapter2/data_and_basic_modeling.html#sec-learners
Package mlr3extralearners for more learners.
as.data.table(mlr_learners) for a table of available Learners in the running session (depending on the loaded packages).
mlr3pipelines to combine learners with pre- and postprocessing steps.
Extension packages for additional task types:
mlr3proba for probabilistic supervised regression and survival analysis.
mlr3cluster for unsupervised clustering.
mlr3tuning for tuning of hyperparameters, mlr3tuningspaces for established default tuning spaces.
Other Learner:
mlr_learners_clust.MBatchKMeans,
mlr_learners_clust.SimpleKMeans,
mlr_learners_clust.agnes,
mlr_learners_clust.ap,
mlr_learners_clust.bico,
mlr_learners_clust.birch,
mlr_learners_clust.clara,
mlr_learners_clust.cmeans,
mlr_learners_clust.cobweb,
mlr_learners_clust.dbscan,
mlr_learners_clust.dbscan_fpc,
mlr_learners_clust.diana,
mlr_learners_clust.em,
mlr_learners_clust.fanny,
mlr_learners_clust.featureless,
mlr_learners_clust.ff,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.optics,
mlr_learners_clust.protoclust,
mlr_learners_clust.specc,
mlr_learners_clust.xmeans
# Define the Learner and set parameter values learner = lrn("clust.pam") print(learner) # Define a Task task = tsk("usarrests") # Train the learner on the task learner$train(task) # Print the model print(learner$model) # Make predictions for the task prediction = learner$predict(task) # Score the predictions prediction$score(task = task)# Define the Learner and set parameter values learner = lrn("clust.pam") print(learner) # Define a Task task = tsk("usarrests") # Train the learner on the task learner$train(task) # Print the model print(learner$model) # Make predictions for the task prediction = learner$predict(task) # Score the predictions prediction$score(task = task)
Hierarchical clustering using minimax linkage with prototypes.
Calls protoclust::protoclust() from package protoclust.
There is no predict method for protoclust::protoclust(), so the method
returns cluster labels for the training data.
This mlr3::Learner can be instantiated via the dictionary mlr3::mlr_learners or with the associated sugar function mlr3::lrn():
mlr_learners$get("clust.protoclust")
lrn("clust.protoclust")
Task type: “clust”
Predict Types: “partition”
Feature Types: “logical”, “integer”, “numeric”
Required Packages: mlr3, mlr3cluster, protoclust
| Id | Type | Default | Levels | Range |
| method | character | euclidean | euclidean, maximum, manhattan, canberra, binary, minkowski | - |
| diag | logical | FALSE | TRUE, FALSE | - |
| upper | logical | FALSE | TRUE, FALSE | - |
| p | numeric | 2 | |
|
| verb | logical | FALSE | TRUE, FALSE | - |
| k | integer | NULL |
|
mlr3::Learner -> mlr3cluster::LearnerClust -> LearnerClustProtoclust
new()
Creates a new instance of this R6 class.
LearnerClustProtoclust$new()
clone()
The objects of this class are cloneable with this method.
LearnerClustProtoclust$clone(deep = FALSE)
deepWhether to make a deep clone.
Bien, Jacob, Tibshirani, Robert (2011). “Hierarchical Clustering with Prototypes via Minimax Linkage.” Journal of the American Statistical Association, 106(495), 1075–1084.
Chapter in the mlr3book: https://mlr3book.mlr-org.com/chapters/chapter2/data_and_basic_modeling.html#sec-learners
Package mlr3extralearners for more learners.
as.data.table(mlr_learners) for a table of available Learners in the running session (depending on the loaded packages).
mlr3pipelines to combine learners with pre- and postprocessing steps.
Extension packages for additional task types:
mlr3proba for probabilistic supervised regression and survival analysis.
mlr3cluster for unsupervised clustering.
mlr3tuning for tuning of hyperparameters, mlr3tuningspaces for established default tuning spaces.
Other Learner:
mlr_learners_clust.MBatchKMeans,
mlr_learners_clust.SimpleKMeans,
mlr_learners_clust.agnes,
mlr_learners_clust.ap,
mlr_learners_clust.bico,
mlr_learners_clust.birch,
mlr_learners_clust.clara,
mlr_learners_clust.cmeans,
mlr_learners_clust.cobweb,
mlr_learners_clust.dbscan,
mlr_learners_clust.dbscan_fpc,
mlr_learners_clust.diana,
mlr_learners_clust.em,
mlr_learners_clust.fanny,
mlr_learners_clust.featureless,
mlr_learners_clust.ff,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.specc,
mlr_learners_clust.xmeans
# Define the Learner and set parameter values learner = lrn("clust.protoclust") print(learner) # Define a Task task = tsk("usarrests") # Train the learner on the task learner$train(task) # Print the model print(learner$model) # Make predictions for the task prediction = learner$predict(task) # Score the predictions prediction$score(task = task)# Define the Learner and set parameter values learner = lrn("clust.protoclust") print(learner) # Define a Task task = tsk("usarrests") # Train the learner on the task learner$train(task) # Print the model print(learner$model) # Make predictions for the task prediction = learner$predict(task) # Score the predictions prediction$score(task = task)
K-means clustering (Weka).
Calls RWeka::SimpleKMeans() from package RWeka.
The predict method uses RWeka::predict.Weka_clusterer() to compute the
cluster memberships for new data.
This mlr3::Learner can be instantiated via the dictionary mlr3::mlr_learners or with the associated sugar function mlr3::lrn():
mlr_learners$get("clust.SimpleKMeans")
lrn("clust.SimpleKMeans")
Task type: “clust”
Predict Types: “partition”
Feature Types: “logical”, “integer”, “numeric”
Required Packages: mlr3, mlr3cluster, RWeka
| Id | Type | Default | Levels | Range |
| A | untyped | "weka.core.EuclideanDistance" | - | |
| C | logical | FALSE | TRUE, FALSE | - |
| fast | logical | FALSE | TRUE, FALSE | - |
| I | integer | 100 | |
|
| init | integer | 0 | |
|
| M | logical | FALSE | TRUE, FALSE | - |
| max_candidates | integer | 100 | |
|
| min_density | integer | 2 | |
|
| N | integer | 2 | |
|
| num_slots | integer | 1 | |
|
| O | logical | FALSE | TRUE, FALSE | - |
| periodic_pruning | integer | 10000 | |
|
| S | integer | 10 | |
|
| t2 | numeric | -1 | |
|
| t1 | numeric | -1.5 | |
|
| V | logical | FALSE | TRUE, FALSE | - |
| output_debug_info | logical | FALSE | TRUE, FALSE | - |
mlr3::Learner -> mlr3cluster::LearnerClust -> LearnerClustSimpleKMeans
new()
Creates a new instance of this R6 class.
LearnerClustSimpleKMeans$new()
clone()
The objects of this class are cloneable with this method.
LearnerClustSimpleKMeans$clone(deep = FALSE)
deepWhether to make a deep clone.
Witten, H I, Frank, Eibe (2002). “Data mining: practical machine learning tools and techniques with Java implementations.” Acm Sigmod Record, 31(1), 76–77.
Forgy, W E (1965). “Cluster analysis of multivariate data: efficiency versus interpretability of classifications.” Biometrics, 21, 768–769.
Lloyd, P S (1982). “Least squares quantization in PCM.” IEEE Transactions on Information Theory, 28(2), 129–137.
MacQueen, James (1967). “Some methods for classification and analysis of multivariate observations.” In Proceedings of the Fifth Berkeley Symposium on Mathematical Statistics and Probability, volume 1, 281–297.
Chapter in the mlr3book: https://mlr3book.mlr-org.com/chapters/chapter2/data_and_basic_modeling.html#sec-learners
Package mlr3extralearners for more learners.
as.data.table(mlr_learners) for a table of available Learners in the running session (depending on the loaded packages).
mlr3pipelines to combine learners with pre- and postprocessing steps.
Extension packages for additional task types:
mlr3proba for probabilistic supervised regression and survival analysis.
mlr3cluster for unsupervised clustering.
mlr3tuning for tuning of hyperparameters, mlr3tuningspaces for established default tuning spaces.
Other Learner:
mlr_learners_clust.MBatchKMeans,
mlr_learners_clust.agnes,
mlr_learners_clust.ap,
mlr_learners_clust.bico,
mlr_learners_clust.birch,
mlr_learners_clust.clara,
mlr_learners_clust.cmeans,
mlr_learners_clust.cobweb,
mlr_learners_clust.dbscan,
mlr_learners_clust.dbscan_fpc,
mlr_learners_clust.diana,
mlr_learners_clust.em,
mlr_learners_clust.fanny,
mlr_learners_clust.featureless,
mlr_learners_clust.ff,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.specc,
mlr_learners_clust.xmeans
# Define the Learner and set parameter values learner = lrn("clust.SimpleKMeans") print(learner) # Define a Task task = tsk("usarrests") # Train the learner on the task learner$train(task) # Print the model print(learner$model) # Make predictions for the task prediction = learner$predict(task) # Score the predictions prediction$score(task = task)# Define the Learner and set parameter values learner = lrn("clust.SimpleKMeans") print(learner) # Define a Task task = tsk("usarrests") # Train the learner on the task learner$train(task) # Print the model print(learner$model) # Make predictions for the task prediction = learner$predict(task) # Score the predictions prediction$score(task = task)
Spectral clustering.
Calls kernlab::specc() from package kernlab.
The centers parameter is set to 2 by default since kernlab::specc()
doesn't have a default value for the number of clusters.
Kernel parameters have to be passed directly and not by using the kpar list in kernlab::specc().
There is no predict method for kernlab::specc(), so the method
returns cluster labels for the training data.
This mlr3::Learner can be instantiated via the dictionary mlr3::mlr_learners or with the associated sugar function mlr3::lrn():
mlr_learners$get("clust.specc")
lrn("clust.specc")
Task type: “clust”
Predict Types: “partition”
Feature Types: “logical”, “integer”, “numeric”
Required Packages: mlr3, mlr3cluster, kernlab
| Id | Type | Default | Levels | Range |
| centers | integer | - | |
|
| kernel | character | rbfdot | rbfdot, polydot, vanilladot, tanhdot, laplacedot, besseldot, anovadot, splinedot | - |
| sigma | numeric | - | |
|
| degree | integer | 3 | |
|
| scale | numeric | 1 | |
|
| offset | numeric | 1 | |
|
| order | integer | 1 | |
|
| nystrom.red | logical | FALSE | TRUE, FALSE | - |
| nystrom.sample | integer | - | |
|
| iterations | integer | 200 | |
|
| mod.sample | numeric | 0.75 |
|
mlr3::Learner -> mlr3cluster::LearnerClust -> LearnerClustSpectral
new()
Creates a new instance of this R6 class.
LearnerClustSpectral$new()
clone()
The objects of this class are cloneable with this method.
LearnerClustSpectral$clone(deep = FALSE)
deepWhether to make a deep clone.
Karatzoglou, Alexandros, Smola, Alexandros, Hornik, Kurt, Zeileis, Achim (2004). “kernlab-an S4 package for kernel methods in R.” Journal of statistical software, 11, 1–20.
Ng, Y A, Jordan, I M, Weiss, Yair (2001). “On Spectral Clustering: Analysis and an Algorithm.” In Advances in Neural Information Processing Systems, volume 14.
Chapter in the mlr3book: https://mlr3book.mlr-org.com/chapters/chapter2/data_and_basic_modeling.html#sec-learners
Package mlr3extralearners for more learners.
as.data.table(mlr_learners) for a table of available Learners in the running session (depending on the loaded packages).
mlr3pipelines to combine learners with pre- and postprocessing steps.
Extension packages for additional task types:
mlr3proba for probabilistic supervised regression and survival analysis.
mlr3cluster for unsupervised clustering.
mlr3tuning for tuning of hyperparameters, mlr3tuningspaces for established default tuning spaces.
Other Learner:
mlr_learners_clust.MBatchKMeans,
mlr_learners_clust.SimpleKMeans,
mlr_learners_clust.agnes,
mlr_learners_clust.ap,
mlr_learners_clust.bico,
mlr_learners_clust.birch,
mlr_learners_clust.clara,
mlr_learners_clust.cmeans,
mlr_learners_clust.cobweb,
mlr_learners_clust.dbscan,
mlr_learners_clust.dbscan_fpc,
mlr_learners_clust.diana,
mlr_learners_clust.em,
mlr_learners_clust.fanny,
mlr_learners_clust.featureless,
mlr_learners_clust.ff,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.xmeans
# Define the Learner and set parameter values learner = lrn("clust.specc") print(learner) # Define a Task task = tsk("usarrests") # Train the learner on the task learner$train(task) # Print the model print(learner$model) # Make predictions for the task prediction = learner$predict(task) # Score the predictions prediction$score(task = task)# Define the Learner and set parameter values learner = lrn("clust.specc") print(learner) # Define a Task task = tsk("usarrests") # Train the learner on the task learner$train(task) # Print the model print(learner$model) # Make predictions for the task prediction = learner$predict(task) # Score the predictions prediction$score(task = task)
X-means clustering.
Calls RWeka::XMeans() from package RWeka.
The predict method uses RWeka::predict.Weka_clusterer() to compute the
cluster memberships for new data.
This mlr3::Learner can be instantiated via the dictionary mlr3::mlr_learners or with the associated sugar function mlr3::lrn():
mlr_learners$get("clust.xmeans")
lrn("clust.xmeans")
Task type: “clust”
Predict Types: “partition”
Feature Types: “logical”, “integer”, “numeric”
Required Packages: mlr3, mlr3cluster, RWeka
| Id | Type | Default | Levels | Range |
| B | numeric | 1 | |
|
| C | numeric | 0 | |
|
| D | untyped | "weka.core.EuclideanDistance" | - | |
| H | integer | 4 | |
|
| I | integer | 1 | |
|
| J | integer | 1000 | |
|
| K | untyped | "" | - | |
| L | integer | 2 | |
|
| M | integer | 1000 | |
|
| S | integer | 10 | |
|
| U | integer | 0 | |
|
| use_kdtree | logical | FALSE | TRUE, FALSE | - |
| N | untyped | - | - | |
| O | untyped | - | - | |
| Y | untyped | - | - | |
| output_debug_info | logical | FALSE | TRUE, FALSE | - |
mlr3::Learner -> mlr3cluster::LearnerClust -> LearnerClustXMeans
new()
Creates a new instance of this R6 class.
LearnerClustXMeans$new()
clone()
The objects of this class are cloneable with this method.
LearnerClustXMeans$clone(deep = FALSE)
deepWhether to make a deep clone.
Witten, H I, Frank, Eibe (2002). “Data mining: practical machine learning tools and techniques with Java implementations.” Acm Sigmod Record, 31(1), 76–77.
Pelleg, Dan, Moore, W A, others (2000). “X-means: Extending k-means with efficient estimation of the number of clusters.” In Icml, volume 1, 727–734.
Chapter in the mlr3book: https://mlr3book.mlr-org.com/chapters/chapter2/data_and_basic_modeling.html#sec-learners
Package mlr3extralearners for more learners.
as.data.table(mlr_learners) for a table of available Learners in the running session (depending on the loaded packages).
mlr3pipelines to combine learners with pre- and postprocessing steps.
Extension packages for additional task types:
mlr3proba for probabilistic supervised regression and survival analysis.
mlr3cluster for unsupervised clustering.
mlr3tuning for tuning of hyperparameters, mlr3tuningspaces for established default tuning spaces.
Other Learner:
mlr_learners_clust.MBatchKMeans,
mlr_learners_clust.SimpleKMeans,
mlr_learners_clust.agnes,
mlr_learners_clust.ap,
mlr_learners_clust.bico,
mlr_learners_clust.birch,
mlr_learners_clust.clara,
mlr_learners_clust.cmeans,
mlr_learners_clust.cobweb,
mlr_learners_clust.dbscan,
mlr_learners_clust.dbscan_fpc,
mlr_learners_clust.diana,
mlr_learners_clust.em,
mlr_learners_clust.fanny,
mlr_learners_clust.featureless,
mlr_learners_clust.ff,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.specc
# Define the Learner and set parameter values learner = lrn("clust.xmeans") print(learner)# Define the Learner and set parameter values learner = lrn("clust.xmeans") print(learner)
The score function calls fpc::cluster.stats() from package fpc.
"ch" is used to subset the output of the function call.
R6::R6Class() inheriting from MeasureClust.
This measure can be retrieved from the dictionary mlr3::mlr_measures:
mlr_measures$get("clust.ch")
msr("clust.ch")
Range:
Minimize: FALSE
Required predict type: partition
Dictionary of Measures: mlr3::mlr_measures
as.data.table(mlr_measures) for a complete table of all (also dynamically created) mlr3::Measure implementations.
Other cluster measures:
mlr_measures_clust.dunn,
mlr_measures_clust.silhouette,
mlr_measures_clust.wss
The score function calls fpc::cluster.stats() from package fpc.
"dunn" is used to subset the output of the function call.
R6::R6Class() inheriting from MeasureClust.
This measure can be retrieved from the dictionary mlr3::mlr_measures:
mlr_measures$get("clust.dunn")
msr("clust.dunn")
Range:
Minimize: FALSE
Required predict type: partition
Dictionary of Measures: mlr3::mlr_measures
as.data.table(mlr_measures) for a complete table of all (also dynamically created) mlr3::Measure implementations.
Other cluster measures:
mlr_measures_clust.ch,
mlr_measures_clust.silhouette,
mlr_measures_clust.wss
The score function calls cluster::silhouette() from package cluster.
"sil_width" is used to subset the output of the function call.
R6::R6Class() inheriting from MeasureClust.
This measure can be retrieved from the dictionary mlr3::mlr_measures:
mlr_measures$get("clust.silhouette")
msr("clust.silhouette")
Range:
Minimize: FALSE
Required predict type: partition
Dictionary of Measures: mlr3::mlr_measures
as.data.table(mlr_measures) for a complete table of all (also dynamically created) mlr3::Measure implementations.
Other cluster measures:
mlr_measures_clust.ch,
mlr_measures_clust.dunn,
mlr_measures_clust.wss
The score function calls fpc::cluster.stats() from package fpc.
"within.cluster.ss" is used to subset the output of the function call.
R6::R6Class() inheriting from MeasureClust.
This measure can be retrieved from the dictionary mlr3::mlr_measures:
mlr_measures$get("clust.wss")
msr("clust.wss")
Range:
Minimize: TRUE
Required predict type: partition
Dictionary of Measures: mlr3::mlr_measures
as.data.table(mlr_measures) for a complete table of all (also dynamically created) mlr3::Measure implementations.
Other cluster measures:
mlr_measures_clust.ch,
mlr_measures_clust.dunn,
mlr_measures_clust.silhouette
A cluster task for the cluster::ruspini data set.
R6::R6Class inheriting from TaskClust.
This mlr3::Task can be instantiated via the dictionary mlr3::mlr_tasks or with the associated sugar function mlr3::tsk():
mlr_tasks$get("ruspini")
tsk("ruspini")
Task type: “clust”
Dimensions: 75x2
Properties: -
Has Missings: FALSE
Target: -
Features: “x”, “y”
Ruspini EH (1970). “Numerical methods for fuzzy clustering.” Information Sciences, 2(3), 319-350. doi:10.1016/S0020-0255(70)80056-1.
Chapter in the mlr3book: https://mlr3book.mlr-org.com/chapters/chapter2/data_and_basic_modeling.html
Package mlr3data for more toy tasks.
Package mlr3oml for downloading tasks from https://www.openml.org.
Package mlr3viz for some generic visualizations.
as.data.table(mlr_tasks) for a table of available Tasks in the running session (depending on the loaded packages).
mlr3fselect and mlr3filters for feature selection and feature filtering.
Extension packages for additional task types:
Unsupervised clustering: mlr3cluster
Probabilistic supervised regression and survival analysis: https://mlr3proba.mlr-org.com/.
Other Task:
TaskClust,
mlr_tasks_usarrests
A cluster task for the datasets::USArrests data set.
Rownames are stored as variable "states" with column role "name".
R6::R6Class inheriting from TaskClust.
This mlr3::Task can be instantiated via the dictionary mlr3::mlr_tasks or with the associated sugar function mlr3::tsk():
mlr_tasks$get("usarrests")
tsk("usarrests")
Task type: “clust”
Dimensions: 50x4
Properties: -
Has Missings: FALSE
Target: -
Features: “Assault”, “Murder”, “Rape”, “UrbanPop”
Berry, Brian J (1979). “Interactive Data Analysis: A Practical Primer.” Journal of the Royal Statistical Society: Series C (Applied Statistics), 28, 181.
Chapter in the mlr3book: https://mlr3book.mlr-org.com/chapters/chapter2/data_and_basic_modeling.html
Package mlr3data for more toy tasks.
Package mlr3oml for downloading tasks from https://www.openml.org.
Package mlr3viz for some generic visualizations.
as.data.table(mlr_tasks) for a table of available Tasks in the running session (depending on the loaded packages).
mlr3fselect and mlr3filters for feature selection and feature filtering.
Extension packages for additional task types:
Unsupervised clustering: mlr3cluster
Probabilistic supervised regression and survival analysis: https://mlr3proba.mlr-org.com/.
Other Task:
TaskClust,
mlr_tasks_ruspini
This object wraps the predictions returned by a learner of class LearnerClust, i.e. the predicted partition and cluster probability.
mlr3::Prediction -> PredictionClust
partition(integer())
Access the stored partition.
prob(matrix() | NULL)
Access to the stored probabilities.
new()
Creates a new instance of this R6 class.
PredictionClust$new( task = NULL, row_ids = task$row_ids, partition = NULL, prob = NULL, check = TRUE )
task(TaskClust | NULL)
Task, used to extract defaults for row_ids.
row_ids(integer())
Row ids of the predicted observations, i.e. the row ids of the test set.
partition(integer() | NULL)
Vector of cluster partitions.
prob(matrix() | NULL)
Numeric matrix of cluster membership probabilities with one column for each cluster
and one row for each observation.
Columns must be named with cluster numbers, row names are automatically removed.
If prob is provided, but partition is not, the cluster memberships are calculated from
the probabilities using max.col() with ties.method set to "first".
check(logical(1))
If TRUE, performs some argument checks and predict type conversions.
clone()
The objects of this class are cloneable with this method.
PredictionClust$clone(deep = FALSE)
deepWhether to make a deep clone.
library(mlr3) library(mlr3cluster) task = tsk("usarrests") learner = lrn("clust.kmeans") p = learner$train(task)$predict(task) p$predict_types head(as.data.table(p))library(mlr3) library(mlr3cluster) task = tsk("usarrests") learner = lrn("clust.kmeans") p = learner$train(task)$predict(task) p$predict_types head(as.data.table(p))
This task specializes mlr3::Task for cluster problems.
As an unsupervised task, this task has no target column.
The task_type is set to "clust".
Predefined tasks are stored in the dictionary mlr3::mlr_tasks.
mlr3::Task -> mlr3::TaskUnsupervised -> TaskClust
mlr3::Task$add_strata()mlr3::Task$cbind()mlr3::Task$data()mlr3::Task$divide()mlr3::Task$droplevels()mlr3::Task$filter()mlr3::Task$format()mlr3::Task$formula()mlr3::Task$head()mlr3::Task$help()mlr3::Task$levels()mlr3::Task$materialize_view()mlr3::Task$missings()mlr3::Task$print()mlr3::Task$rbind()mlr3::Task$rename()mlr3::Task$select()mlr3::Task$set_col_roles()mlr3::Task$set_levels()mlr3::Task$set_row_roles()new()
Creates a new instance of this R6 class.
TaskClust$new(id, backend, label = NA_character_)
id(character(1))
Identifier for the new instance.
backend(mlr3::DataBackend)
Either a mlr3::DataBackend, or any object which is convertible to a mlr3::DataBackend with as_data_backend().
E.g., a data.frame() will be converted to a mlr3::DataBackendDataTable.
label(character(1))
Label for the new instance.
clone()
The objects of this class are cloneable with this method.
TaskClust$clone(deep = FALSE)
deepWhether to make a deep clone.
Other Task:
mlr_tasks_ruspini,
mlr_tasks_usarrests
library(mlr3) library(mlr3cluster) task = TaskClust$new("usarrests", backend = USArrests) task$task_type # possible properties: mlr_reflections$task_properties$clustlibrary(mlr3) library(mlr3cluster) task = TaskClust$new("usarrests", backend = USArrests) task$task_type # possible properties: mlr_reflections$task_properties$clust