| 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.6.0 |
| Built: | 2026-10-17 10:39:38 UTC |
| Source: | https://github.com/mlr-org/mlr3cluster |
Extends the 'mlr3' package with cluster analysis.
Maintainer: Maximilian Mücke [email protected] (ORCID)
Authors:
Maximilian Mücke [email protected] (ORCID)
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.
For a data.frame, the columns row_ids and partition are required.
Columns prefixed with prob. are collected into the probability matrix, weights are stored as measure weights,
and all remaining columns are stored as extra data in the extra field of the prediction.
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 or a list of TaskClust. This is a S3 generic, specialized for at least the following objects:
TaskClust: returns the object as-is, possibly cloned.
formula, data.frame(), matrix(), and mlr3::DataBackend: provides an alternative to the
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)), label = NA_character_, ...) ## S3 method for class 'matrix' as_task_clust(x, id = deparse1(substitute(x)), label = NA_character_, ...) ## S3 method for class 'DataBackend' as_task_clust(x, id = deparse1(substitute(x)), label = NA_character_, ...) ## S3 method for class 'formula' as_task_clust( x, data, id = deparse1(substitute(data)), label = NA_character_, ... ) as_tasks_clust(x, ...) ## S3 method for class 'list' as_tasks_clust(x, clone = FALSE, ...) ## S3 method for class 'TaskClust' as_tasks_clust(x, clone = FALSE, ...)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)), label = NA_character_, ...) ## S3 method for class 'matrix' as_task_clust(x, id = deparse1(substitute(x)), label = NA_character_, ...) ## S3 method for class 'DataBackend' as_task_clust(x, id = deparse1(substitute(x)), label = NA_character_, ...) ## S3 method for class 'formula' as_task_clust( x, data, id = deparse1(substitute(data)), label = NA_character_, ... ) as_tasks_clust(x, ...) ## S3 method for class 'list' as_tasks_clust(x, clone = FALSE, ...) ## S3 method for class 'TaskClust' as_tasks_clust(x, clone = FALSE, ...)
x |
(any) |
... |
(any) |
clone |
( |
id |
( |
label |
( |
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.
Additional learner properties include:
"exclusive": The method natively assigns each observation to exactly one cluster.
"overlapping": The method natively assigns observations to multiple clusters.
"fuzzy": The method natively produces soft cluster memberships, e.g. fuzzy or probabilistic model-based
methods. The hard partition is derived from the memberships.
"complete": Every observation is assigned to a cluster.
"partial": Observations may be left unassigned, e.g. as noise points.
"partitional": The method divides the data into non-nested clusters.
"hierarchical": The method produces a nested hierarchy of clusters.
"density": The method finds clusters as dense regions in the feature space.
These properties describe the nature of the underlying method, not its interface capabilities: whether a learner
can return soft memberships is encoded by the "prob" predict type, which "exclusive" learners may also
support via derived scores.
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.
LearnerClust$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.
"offset": The learner can incorporate offset values to adjust predictions.
"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).
"validation": The learner can use a validation task during training.
"internal_tuning": The learner is able to internally optimize hyperparameters (those are also tagged with "internal_tuning").
"marshal": To save learners with this property, you need to call $marshal() first.
If a learner is in a marshaled state, you call first need to call $unmarshal() to use its model, e.g. for prediction.
"hotstart_forward": The learner supports to hotstart a model forward.
"hotstart_backward": The learner supports hotstarting a model backward.
"featureless": The learner does not use features.
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().
LearnerClust$reset()Reset assignments field before calling parent's reset().
LearnerClust$reset()
LearnerClust$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.featureless") print(learner)library(mlr3) library(mlr3cluster) ids = mlr_learners$keys("^clust") ids # get a specific learner from mlr_learners: learner = lrn("clust.featureless") 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
MeasureClust$new()Creates a new instance of this R6 class.
MeasureClust$new( id, param_set = ps(), range, minimize = NA, average = "macro", aggregator = NULL, properties = character(), predict_type = "partition", predict_sets = "test", task_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.
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.
average(character(1))
How to average multiple mlr3::Predictions from a ResampleResult.
The default, "macro", calculates the individual performances scores for each mlr3::Prediction and then uses the
function defined in $aggregator to average them to a single number.
"macro_weighted" is similar to "macro", but uses weighted averages.
Weights are taken from the weights_measure column of the resampled mlr3::Task if present.
Note that "macro_weighted" can differ from "macro" even if no weights are present or if $use_weights is set to "ignore",
since then aggregation is done using uniform sample weights, which result in non-uniform weights for mlr3::Predictions if they contain different
numbers of samples.
If set to "micro", the individual mlr3::Prediction objects are first combined into a single new mlr3::Prediction object which is then used to assess the performance.
The function in $aggregator is not used in this case.
aggregator(function() | NULL)
Function to aggregate over multiple iterations. The role of this function depends on
the value of field "average":
"macro": A numeric vector of scores (one per iteration) is passed.
The aggregate function defaults to mean() in this case.
"micro": The aggregator function is not used.
Instead, predictions from multiple iterations are first combined and then
scored in one go.
"custom": A ResampleResult is passed to the aggregate function.
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_model" (requires the trained mlr3::Learner, including the fitted model),
"requires_train_set" (requires the training indices from the mlr3::Resampling),
"na_score" (the measure is expected to occasionally return NA or NaN),
"weights" (support weighted scoring using sample weights from task, column role weights_measure),
"primary_iters" (the measure explicitly handles resamplings
that only use a subset of their iterations for the point estimate), and
"requires_no_prediction" (No prediction is required;
This usually means that the measure extracts some information from the learner state.).
predict_type(character(1))
Required predict type of the mlr3::Learner.
Possible values are stored in mlr_reflections$learner_predict_types.
predict_sets(character())
Prediction sets to operate on, used in aggregate() to extract the matching predict_sets from the ResampleResult.
Multiple predict sets are calculated by the respective mlr3::Learner during resample()/benchmark().
Must be a non-empty subset of {"train", "test", "internal_valid"}.
If multiple sets are provided, these are first combined to a single prediction object.
Default is "test".
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().
MeasureClust$clone()The objects of this class are cloneable with this method.
MeasureClust$clone(deep = FALSE)
deepWhether to make a deep clone.
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).
k:
Not an argument of cluster::agnes(). The number of clusters to cut the tree into,
passed to stats::cutree(). Initialized to 2.
keep.diss:
Actual default: n < 100, where n is the number of observations.
Adjusted default: FALSE.
Reason for change: Avoid storing the dissimilarity matrix in the model to save memory.
keep.data:
Actual default: TRUE.
Adjusted default: FALSE.
Reason for change: Avoid storing the training data in the model to save memory.
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 | - |
| keep.diss | logical | - | TRUE, FALSE | - |
| keep.data | logical | TRUE | TRUE, FALSE | - |
| trace.lev | integer | 0 | |
|
| k | integer | - | |
|
| par.method | untyped | - | - |
mlr3::Learner -> LearnerClust -> LearnerClustAgnes
LearnerClustAgnes$new()Creates a new instance of this R6 class.
LearnerClustAgnes$new()
LearnerClustAgnes$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.
Package mlr3viz for some generic visualizations.
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.flexmix,
mlr_learners_clust.genie,
mlr_learners_clust.gmeans,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kcca,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kmeans_rcpp,
mlr_learners_clust.kmodes,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.movMF,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.skmeans,
mlr_learners_clust.som,
mlr_learners_clust.specc,
mlr_learners_clust.stdbscan,
mlr_learners_clust.tclust,
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.
The similarity s can be a function, e.g. apcluster::negDistMat(r = 2), or the name of a function such as
"negDistMat".
includeSim:
Actual default: TRUE.
Adjusted default: FALSE.
Reason for change: Avoid storing the n x n similarity matrix in the model.
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 | TRUE | TRUE, FALSE | - |
| details | logical | FALSE | TRUE, FALSE | - |
| nonoise | logical | FALSE | TRUE, FALSE | - |
| seed | integer | NA |
|
mlr3::Learner -> LearnerClust -> LearnerClustAP
LearnerClustAP$new()Creates a new instance of this R6 class.
LearnerClustAP$new()
LearnerClustAP$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.
Package mlr3viz for some generic visualizations.
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.flexmix,
mlr_learners_clust.genie,
mlr_learners_clust.gmeans,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kcca,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kmeans_rcpp,
mlr_learners_clust.kmodes,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.movMF,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.skmeans,
mlr_learners_clust.som,
mlr_learners_clust.specc,
mlr_learners_clust.stdbscan,
mlr_learners_clust.tclust,
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.
stream::DSC_BICO() only computes the coreset (micro-clusters), so the coreset is reclustered with k-means via
stream::DSC_TwoStage() and stream::DSC_Kmeans() to obtain the final partition with k 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.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 -> LearnerClust -> LearnerClustBICO
LearnerClustBICO$new()Creates a new instance of this R6 class.
LearnerClustBICO$new()
LearnerClustBICO$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.
Package mlr3viz for some generic visualizations.
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.flexmix,
mlr_learners_clust.genie,
mlr_learners_clust.gmeans,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kcca,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kmeans_rcpp,
mlr_learners_clust.kmodes,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.movMF,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.skmeans,
mlr_learners_clust.som,
mlr_learners_clust.specc,
mlr_learners_clust.stdbscan,
mlr_learners_clust.tclust,
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 -> LearnerClust -> LearnerClustBIRCH
LearnerClustBIRCH$new()Creates a new instance of this R6 class.
LearnerClustBIRCH$new()
LearnerClustBIRCH$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.
Package mlr3viz for some generic visualizations.
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.flexmix,
mlr_learners_clust.genie,
mlr_learners_clust.gmeans,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kcca,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kmeans_rcpp,
mlr_learners_clust.kmodes,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.movMF,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.skmeans,
mlr_learners_clust.som,
mlr_learners_clust.specc,
mlr_learners_clust.stdbscan,
mlr_learners_clust.tclust,
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.
keep.data:
Actual default: TRUE.
Adjusted default: FALSE.
Reason for change: Avoid storing the training data in the model to save memory.
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 -> LearnerClust -> LearnerClustCLARA
LearnerClustCLARA$new()Creates a new instance of this R6 class.
LearnerClustCLARA$new()
LearnerClustCLARA$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.
Package mlr3viz for some generic visualizations.
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.flexmix,
mlr_learners_clust.genie,
mlr_learners_clust.gmeans,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kcca,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kmeans_rcpp,
mlr_learners_clust.kmodes,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.movMF,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.skmeans,
mlr_learners_clust.som,
mlr_learners_clust.specc,
mlr_learners_clust.stdbscan,
mlr_learners_clust.tclust,
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 -> LearnerClust -> LearnerClustCMeans
LearnerClustCMeans$new()Creates a new instance of this R6 class.
LearnerClustCMeans$new()
LearnerClustCMeans$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.
Package mlr3viz for some generic visualizations.
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.flexmix,
mlr_learners_clust.genie,
mlr_learners_clust.gmeans,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kcca,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kmeans_rcpp,
mlr_learners_clust.kmodes,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.movMF,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.skmeans,
mlr_learners_clust.som,
mlr_learners_clust.specc,
mlr_learners_clust.stdbscan,
mlr_learners_clust.tclust,
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 | Levels | Range |
| A | numeric | 1 | |
|
| C | numeric | 0.002820948 | |
|
| save_data | logical | FALSE | TRUE, FALSE | - |
| S | integer | 42 | |
|
| output_debug_info | logical | FALSE | TRUE, FALSE | - |
| do_not_check_capabilities | logical | FALSE | TRUE, FALSE | - |
mlr3::Learner -> LearnerClust -> LearnerClustCobweb
marshaled(logical(1))
Whether the learner's model is marshaled.
LearnerClustCobweb$new()Creates a new instance of this R6 class.
LearnerClustCobweb$new()
LearnerClustCobweb$marshal()Marshal the learner's model.
LearnerClustCobweb$marshal(...)
...(any)
Additional arguments passed to mlr3::marshal_model().
LearnerClustCobweb$unmarshal()Unmarshal the learner's model.
LearnerClustCobweb$unmarshal(...)
...(any)
Additional arguments passed to mlr3::unmarshal_model().
LearnerClustCobweb$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.
Package mlr3viz for some generic visualizations.
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.flexmix,
mlr_learners_clust.genie,
mlr_learners_clust.gmeans,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kcca,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kmeans_rcpp,
mlr_learners_clust.kmodes,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.movMF,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.skmeans,
mlr_learners_clust.som,
mlr_learners_clust.specc,
mlr_learners_clust.stdbscan,
mlr_learners_clust.tclust,
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 | NULL | - | |
| 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 -> LearnerClust -> LearnerClustDBSCAN
LearnerClustDBSCAN$new()Creates a new instance of this R6 class.
LearnerClustDBSCAN$new()
LearnerClustDBSCAN$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.
Package mlr3viz for some generic visualizations.
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.flexmix,
mlr_learners_clust.genie,
mlr_learners_clust.gmeans,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kcca,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kmeans_rcpp,
mlr_learners_clust.kmodes,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.movMF,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.skmeans,
mlr_learners_clust.som,
mlr_learners_clust.specc,
mlr_learners_clust.stdbscan,
mlr_learners_clust.tclust,
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 -> LearnerClust -> LearnerClustDBSCANfpc
LearnerClustDBSCANfpc$new()Creates a new instance of this R6 class.
LearnerClustDBSCANfpc$new()
LearnerClustDBSCANfpc$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.
Package mlr3viz for some generic visualizations.
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.flexmix,
mlr_learners_clust.genie,
mlr_learners_clust.gmeans,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kcca,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kmeans_rcpp,
mlr_learners_clust.kmodes,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.movMF,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.skmeans,
mlr_learners_clust.som,
mlr_learners_clust.specc,
mlr_learners_clust.stdbscan,
mlr_learners_clust.tclust,
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).
k:
Not an argument of cluster::diana(). The number of clusters to cut the tree into,
passed to stats::cutree(). Initialized to 2.
keep.diss:
Actual default: n < 100, where n is the number of observations.
Adjusted default: FALSE.
Reason for change: Avoid storing the dissimilarity matrix in the model to save memory.
keep.data:
Actual default: TRUE.
Adjusted default: FALSE.
Reason for change: Avoid storing the training data in the model to save memory.
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 | - |
| stop.at.k | untyped | FALSE | - | |
| keep.diss | logical | - | TRUE, FALSE | - |
| keep.data | logical | TRUE | TRUE, FALSE | - |
| trace.lev | integer | 0 | |
|
| k | integer | - |
|
mlr3::Learner -> LearnerClust -> LearnerClustDiana
LearnerClustDiana$new()Creates a new instance of this R6 class.
LearnerClustDiana$new()
LearnerClustDiana$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.
Package mlr3viz for some generic visualizations.
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.flexmix,
mlr_learners_clust.genie,
mlr_learners_clust.gmeans,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kcca,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kmeans_rcpp,
mlr_learners_clust.kmodes,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.movMF,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.skmeans,
mlr_learners_clust.som,
mlr_learners_clust.specc,
mlr_learners_clust.stdbscan,
mlr_learners_clust.tclust,
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 | - |
| O | logical | FALSE | TRUE, FALSE | - |
| output_debug_info | logical | FALSE | TRUE, FALSE | - |
| do_not_check_capabilities | logical | FALSE | TRUE, FALSE | - |
mlr3::Learner -> LearnerClust -> LearnerClustEM
marshaled(logical(1))
Whether the learner's model is marshaled.
LearnerClustEM$new()Creates a new instance of this R6 class.
LearnerClustEM$new()
LearnerClustEM$marshal()Marshal the learner's model.
LearnerClustEM$marshal(...)
...(any)
Additional arguments passed to mlr3::marshal_model().
LearnerClustEM$unmarshal()Unmarshal the learner's model.
LearnerClustEM$unmarshal(...)
...(any)
Additional arguments passed to mlr3::unmarshal_model().
LearnerClustEM$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.
Package mlr3viz for some generic visualizations.
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.flexmix,
mlr_learners_clust.genie,
mlr_learners_clust.gmeans,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kcca,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kmeans_rcpp,
mlr_learners_clust.kmodes,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.movMF,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.skmeans,
mlr_learners_clust.som,
mlr_learners_clust.specc,
mlr_learners_clust.stdbscan,
mlr_learners_clust.tclust,
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.
keep.diss:
Actual default: n < 100, where n is the number of observations.
Adjusted default: FALSE.
Reason for change: Avoid storing the dissimilarity matrix in the model to save memory.
keep.data:
Actual default: TRUE.
Adjusted default: FALSE.
Reason for change: Avoid storing the training data in the model to save memory.
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 | - | |
| keep.diss | logical | - | TRUE, FALSE | - |
| keep.data | logical | TRUE | TRUE, FALSE | - |
| maxit | integer | 500 | |
|
| tol | numeric | 1e-15 | |
|
| trace.lev | integer | 0 |
|
mlr3::Learner -> LearnerClust -> LearnerClustFanny
LearnerClustFanny$new()Creates a new instance of this R6 class.
LearnerClustFanny$new()
LearnerClustFanny$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.
Package mlr3viz for some generic visualizations.
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.flexmix,
mlr_learners_clust.genie,
mlr_learners_clust.gmeans,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kcca,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kmeans_rcpp,
mlr_learners_clust.kmodes,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.movMF,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.skmeans,
mlr_learners_clust.som,
mlr_learners_clust.specc,
mlr_learners_clust.stdbscan,
mlr_learners_clust.tclust,
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”, “character”, “factor”, “ordered”, “POSIXct”, “Date”
Required Packages: mlr3, mlr3cluster
| Id | Type | Default | Range |
| num_clusters | integer | - |
|
mlr3::Learner -> LearnerClust -> LearnerClustFeatureless
LearnerClustFeatureless$new()Creates a new instance of this R6 class.
LearnerClustFeatureless$new()
LearnerClustFeatureless$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.
Package mlr3viz for some generic visualizations.
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.flexmix,
mlr_learners_clust.genie,
mlr_learners_clust.gmeans,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kcca,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kmeans_rcpp,
mlr_learners_clust.kmodes,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.movMF,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.skmeans,
mlr_learners_clust.som,
mlr_learners_clust.specc,
mlr_learners_clust.stdbscan,
mlr_learners_clust.tclust,
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 | - |
| do_not_check_capabilities | logical | FALSE | TRUE, FALSE | - |
mlr3::Learner -> LearnerClust -> LearnerClustFarthestFirst
marshaled(logical(1))
Whether the learner's model is marshaled.
LearnerClustFarthestFirst$new()Creates a new instance of this R6 class.
LearnerClustFarthestFirst$new()
LearnerClustFarthestFirst$marshal()Marshal the learner's model.
LearnerClustFarthestFirst$marshal(...)
...(any)
Additional arguments passed to mlr3::marshal_model().
LearnerClustFarthestFirst$unmarshal()Unmarshal the learner's model.
LearnerClustFarthestFirst$unmarshal(...)
...(any)
Additional arguments passed to mlr3::unmarshal_model().
LearnerClustFarthestFirst$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.
Package mlr3viz for some generic visualizations.
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.flexmix,
mlr_learners_clust.genie,
mlr_learners_clust.gmeans,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kcca,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kmeans_rcpp,
mlr_learners_clust.kmodes,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.movMF,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.skmeans,
mlr_learners_clust.som,
mlr_learners_clust.specc,
mlr_learners_clust.stdbscan,
mlr_learners_clust.tclust,
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)
Finite mixture model clustering via the EM algorithm.
Calls flexmix::stepFlexmix() from package flexmix, which runs nrep EM repetitions and keeps the
best fit. When cluster provides fixed initial assignments, flexmix::flexmix() is called instead and nrep
must not be larger than 1.
The k parameter is set to 2 by default since flexmix::stepFlexmix() doesn't have a default value for the number
of components.
The component model is selected through the model parameter, exposing the multivariate normal, univariate normal,
multivariate binary, and multivariate Poisson drivers shipped with flexmix.
The predict method calls flexmix::clusters() for cluster assignments and flexmix::posterior() for component
probabilities on new data.
Note that EM can prune components whose prior falls below minprior during fitting, so the final number of
components may be smaller than k.
This mlr3::Learner can be instantiated via the dictionary mlr3::mlr_learners or with the associated sugar function mlr3::lrn():
mlr_learners$get("clust.flexmix")
lrn("clust.flexmix")
Task type: “clust”
Predict Types: “partition”, “prob”
Feature Types: “logical”, “integer”, “numeric”
Required Packages: mlr3, mlr3cluster, flexmix, mvtnorm
| Id | Type | Default | Levels | Range |
| k | integer | - | |
|
| model | character | FLXMCmvnorm | FLXMCmvnorm, FLXMCnorm1, FLXMCmvbinary, FLXMCmvpois | - |
| diagonal | logical | TRUE | TRUE, FALSE | - |
| truncated | logical | FALSE | TRUE, FALSE | - |
| cluster | untyped | NULL | - | |
| iter.max | integer | 200 | |
|
| minprior | numeric | 0.05 | |
|
| tolerance | numeric | 1e-06 | |
|
| verbose | integer | 0 | |
|
| classify | character | auto | auto, weighted, CEM, SEM, hard, random | - |
| nrep | integer | 1 |
|
mlr3::Learner -> LearnerClust -> LearnerClustFlexmix
LearnerClustFlexmix$new()Creates a new instance of this R6 class.
LearnerClustFlexmix$new()
LearnerClustFlexmix$clone()The objects of this class are cloneable with this method.
LearnerClustFlexmix$clone(deep = FALSE)
deepWhether to make a deep clone.
Leisch, Friedrich (2004). “FlexMix: A General Framework for Finite Mixture Models and Latent Class Regression in R.” Journal of Statistical Software, 11(8), 1–18. doi:10.18637/jss.v011.i08.
Grün, Bettina, Leisch, Friedrich (2008). “FlexMix Version 2: Finite Mixtures with Concomitant Variables and Varying and Constant Parameters.” Journal of Statistical Software, 28(4), 1–35. doi:10.18637/jss.v028.i04.
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.
Package mlr3viz for some generic visualizations.
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.genie,
mlr_learners_clust.gmeans,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kcca,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kmeans_rcpp,
mlr_learners_clust.kmodes,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.movMF,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.skmeans,
mlr_learners_clust.som,
mlr_learners_clust.specc,
mlr_learners_clust.stdbscan,
mlr_learners_clust.tclust,
mlr_learners_clust.xmeans
# Define the Learner and set parameter values learner = lrn("clust.flexmix") 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.flexmix") 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)
Genie hierarchical clustering, a fast and robust outlier-resistant algorithm based on the Gini inequality measure
applied to cluster sizes during the linkage process.
Calls genieclust::gclust() from package genieclust.
There is no predict method for genieclust::gclust(), so the method returns cluster labels for the training data
obtained via stats::cutree() at the requested k.
The task must have at least 2 features.
k:
Not an argument of genieclust::gclust(). The number of clusters to cut the tree into,
passed to stats::cutree(). Initialized to 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.genie")
lrn("clust.genie")
Task type: “clust”
Predict Types: “partition”
Feature Types: “logical”, “integer”, “numeric”
Required Packages: mlr3, mlr3cluster, genieclust
| Id | Type | Default | Levels | Range |
| gini_threshold | numeric | 0.3 | |
|
| M | integer | 0 | |
|
| distance | character | euclidean | euclidean, l2, manhattan, cityblock, l1, cosine | - |
| verbose | logical | FALSE | TRUE, FALSE | - |
| k | integer | - |
|
mlr3::Learner -> LearnerClust -> LearnerClustGenie
LearnerClustGenie$new()Creates a new instance of this R6 class.
LearnerClustGenie$new()
LearnerClustGenie$clone()The objects of this class are cloneable with this method.
LearnerClustGenie$clone(deep = FALSE)
deepWhether to make a deep clone.
Gagolewski, Marek, Bartoszuk, Maciej, Cena, Anna (2016). “Genie: A new, fast, and outlier-resistant hierarchical clustering algorithm.” Information Sciences, 363, 8–23. doi:10.1016/j.ins.2016.05.003.
Gagolewski, Marek (2021). “genieclust: Fast and robust hierarchical clustering.” SoftwareX, 15, 100722. doi:10.1016/j.softx.2021.100722.
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.
Package mlr3viz for some generic visualizations.
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.flexmix,
mlr_learners_clust.gmeans,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kcca,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kmeans_rcpp,
mlr_learners_clust.kmodes,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.movMF,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.skmeans,
mlr_learners_clust.som,
mlr_learners_clust.specc,
mlr_learners_clust.stdbscan,
mlr_learners_clust.tclust,
mlr_learners_clust.xmeans
# Define the Learner and set parameter values learner = lrn("clust.genie") 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.genie") 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)
G-means clustering.
Calls gmeans::gmeans() from package gmeans.
G-means extends k-means by automatically determining the number of clusters: starting from k_init centers, each
cluster is repeatedly split in two unless an Anderson-Darling test suggests its points already follow a Gaussian
distribution, until no more centers are added or k_max is reached. The predict method assigns new observations to
the nearest cluster center.
This mlr3::Learner can be instantiated via the dictionary mlr3::mlr_learners or with the associated sugar function mlr3::lrn():
mlr_learners$get("clust.gmeans")
lrn("clust.gmeans")
Task type: “clust”
Predict Types: “partition”
Feature Types: “logical”, “integer”, “numeric”
Required Packages: mlr3, mlr3cluster, gmeans
| Id | Type | Default | Levels | Range |
| k_init | integer | 2 | |
|
| k_max | integer | 10 | |
|
| level | numeric | 0.05 | |
|
| iter.max | integer | 10 | |
|
| algorithm | character | Hartigan-Wong | Hartigan-Wong, Lloyd, Forgy, MacQueen | - |
| trace | logical | FALSE | TRUE, FALSE | - |
| method | character | euclidean | euclidean, manhattan, minkowski | - |
| p | numeric | 2 |
|
mlr3::Learner -> LearnerClust -> LearnerClustGMeans
LearnerClustGMeans$new()Creates a new instance of this R6 class.
LearnerClustGMeans$new()
LearnerClustGMeans$clone()The objects of this class are cloneable with this method.
LearnerClustGMeans$clone(deep = FALSE)
deepWhether to make a deep clone.
Hamerly, Greg, Elkan, Charles (2003). “Learning the k in k-means.” In Advances in Neural Information Processing Systems, volume 16.
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.
Package mlr3viz for some generic visualizations.
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.flexmix,
mlr_learners_clust.genie,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kcca,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kmeans_rcpp,
mlr_learners_clust.kmodes,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.movMF,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.skmeans,
mlr_learners_clust.som,
mlr_learners_clust.specc,
mlr_learners_clust.stdbscan,
mlr_learners_clust.tclust,
mlr_learners_clust.xmeans
# Define the Learner and set parameter values learner = lrn("clust.gmeans") 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.gmeans") 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().
distmethod:
Not an argument of stats::hclust(). The distance measure, passed as method to stats::dist() when
computing the dissimilarity matrix.
diag, upper, p:
Not arguments of stats::hclust(). Forwarded to stats::dist() when computing the dissimilarity matrix.
k:
Not an argument of stats::hclust(). The number of clusters to cut the tree into,
passed to stats::cutree(). Initialized to 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.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 | - |
|
mlr3::Learner -> LearnerClust -> LearnerClustHclust
LearnerClustHclust$new()Creates a new instance of this R6 class.
LearnerClustHclust$new()
LearnerClustHclust$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.
Package mlr3viz for some generic visualizations.
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.flexmix,
mlr_learners_clust.genie,
mlr_learners_clust.gmeans,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kcca,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kmeans_rcpp,
mlr_learners_clust.kmodes,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.movMF,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.skmeans,
mlr_learners_clust.som,
mlr_learners_clust.specc,
mlr_learners_clust.stdbscan,
mlr_learners_clust.tclust,
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.
The minPts parameter is set to 5 by default since dbscan::hdbscan() doesn't have a default value for the minimum
size 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.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 -> LearnerClust -> LearnerClustHDBSCAN
LearnerClustHDBSCAN$new()Creates a new instance of this R6 class.
LearnerClustHDBSCAN$new()
LearnerClustHDBSCAN$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.
Package mlr3viz for some generic visualizations.
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.flexmix,
mlr_learners_clust.genie,
mlr_learners_clust.gmeans,
mlr_learners_clust.hclust,
mlr_learners_clust.kcca,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kmeans_rcpp,
mlr_learners_clust.kmodes,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.movMF,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.skmeans,
mlr_learners_clust.som,
mlr_learners_clust.specc,
mlr_learners_clust.stdbscan,
mlr_learners_clust.tclust,
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)
K-Centroids Cluster Analysis - a unified framework for partitional clustering with selectable distance / centroid
families: standard k-means, k-medians, spherical k-means ("angle"), Jaccard, and extended Jaccard.
Calls flexclust::kcca() from package flexclust.
The k parameter is set to 2 by default since flexclust::kcca() has no default value for the number of clusters.
The predict method uses flexclust::clusters() 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.kcca")
lrn("clust.kcca")
Task type: “clust”
Predict Types: “partition”
Feature Types: “logical”, “integer”, “numeric”
Required Packages: mlr3, mlr3cluster, flexclust
| Id | Type | Default | Levels | Range |
| k | integer | - | |
|
| family | character | kmeans | kmeans, kmedians, angle, jaccard, ejaccard | - |
| weights | untyped | NULL | - | |
| group | untyped | NULL | - | |
| simple | logical | FALSE | TRUE, FALSE | - |
| save.data | logical | FALSE | TRUE, FALSE | - |
| iter.max | integer | 200 | |
|
| tolerance | numeric | 1e-06 | |
|
| verbose | integer | 0 | |
|
| classify | character | auto | auto, weighted, hard, simann | - |
| initcent | untyped | "randomcent" | - | |
| gamma | numeric | 1 | |
|
| simann | untyped | c(0.3, 0.95, 10) | - |
mlr3::Learner -> LearnerClust -> LearnerClustKCCA
LearnerClustKCCA$new()Creates a new instance of this R6 class.
LearnerClustKCCA$new()
LearnerClustKCCA$clone()The objects of this class are cloneable with this method.
LearnerClustKCCA$clone(deep = FALSE)
deepWhether to make a deep clone.
Leisch, Friedrich (2006). “A Toolbox for K-Centroids Cluster Analysis.” Computational Statistics & Data Analysis, 51(2), 526–544. doi:10.1016/j.csda.2005.10.006.
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.
Package mlr3viz for some generic visualizations.
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.flexmix,
mlr_learners_clust.genie,
mlr_learners_clust.gmeans,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kmeans_rcpp,
mlr_learners_clust.kmodes,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.movMF,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.skmeans,
mlr_learners_clust.som,
mlr_learners_clust.specc,
mlr_learners_clust.stdbscan,
mlr_learners_clust.tclust,
mlr_learners_clust.xmeans
# Define the Learner and set parameter values learner = lrn("clust.kcca") 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.kcca") 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.
The predict method assigns each new observation to the cluster whose centroid is nearest in the kernel-induced
feature space, computed from the stored training data. The model is therefore a list containing the fitted
kernlab::kkmeans() object along with the training data and per-cluster kernel statistics.
The task must have at least 2 features.
sigma, degree, scale, offset, order:
In kernlab::kkmeans(), these kernel parameters are passed inside the kpar list. Here they are exposed
directly and assembled into kpar internally.
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 | 1 | |
|
| scale | numeric | 1 | |
|
| offset | numeric | 1 | |
|
| order | integer | 1 | |
|
| alg | character | kkmeans | kkmeans, kerninghan | - |
| p | numeric | 1 |
|
mlr3::Learner -> LearnerClust -> LearnerClustKKMeans
native_model(any)
The fitted model.
LearnerClustKKMeans$new()Creates a new instance of this R6 class.
LearnerClustKKMeans$new()
LearnerClustKKMeans$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.
Package mlr3viz for some generic visualizations.
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.flexmix,
mlr_learners_clust.genie,
mlr_learners_clust.gmeans,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kcca,
mlr_learners_clust.kmeans,
mlr_learners_clust.kmeans_rcpp,
mlr_learners_clust.kmodes,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.movMF,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.skmeans,
mlr_learners_clust.som,
mlr_learners_clust.specc,
mlr_learners_clust.stdbscan,
mlr_learners_clust.tclust,
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 -> LearnerClust -> LearnerClustKMeans
LearnerClustKMeans$new()Creates a new instance of this R6 class.
LearnerClustKMeans$new()
LearnerClustKMeans$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.
Package mlr3viz for some generic visualizations.
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.flexmix,
mlr_learners_clust.genie,
mlr_learners_clust.gmeans,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kcca,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans_rcpp,
mlr_learners_clust.kmodes,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.movMF,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.skmeans,
mlr_learners_clust.som,
mlr_learners_clust.specc,
mlr_learners_clust.stdbscan,
mlr_learners_clust.tclust,
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-means clustering.
Calls ClusterR::KMeans_rcpp() from package ClusterR.
The clusters parameter is set to 2 by default since ClusterR::KMeans_rcpp() doesn't have a default value for
the number of clusters. The predict method computes the cluster memberships for new data via the fitted centroids.
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_rcpp")
lrn("clust.kmeans_rcpp")
Task type: “clust”
Predict Types: “partition”, “prob”
Feature Types: “logical”, “integer”, “numeric”
Required Packages: mlr3, mlr3cluster, ClusterR
| Id | Type | Default | Levels | Range |
| clusters | integer | - | |
|
| num_init | integer | 1 | |
|
| max_iters | integer | 100 | |
|
| initializer | character | kmeans++ | optimal_init, quantile_init, kmeans++, random | - |
| verbose | logical | FALSE | TRUE, FALSE | - |
| CENTROIDS | untyped | NULL | - | |
| tol | numeric | 1e-04 | |
|
| tol_optimal_init | numeric | 0.3 | |
|
| seed | integer | 1 | |
|
| threads | integer | 1 |
|
mlr3::Learner -> LearnerClust -> LearnerClustKMeansRcpp
LearnerClustKMeansRcpp$new()Creates a new instance of this R6 class.
LearnerClustKMeansRcpp$new()
LearnerClustKMeansRcpp$clone()The objects of this class are cloneable with this method.
LearnerClustKMeansRcpp$clone(deep = FALSE)
deepWhether to make a deep clone.
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.
Arthur, David, Vassilvitskii, Sergei (2007). “k-means++: the advantages of careful seeding.” In Proceedings of the Eighteenth Annual ACM-SIAM Symposium on Discrete Algorithms, 1027–1035.
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.
Package mlr3viz for some generic visualizations.
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.flexmix,
mlr_learners_clust.genie,
mlr_learners_clust.gmeans,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kcca,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kmodes,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.movMF,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.skmeans,
mlr_learners_clust.som,
mlr_learners_clust.specc,
mlr_learners_clust.stdbscan,
mlr_learners_clust.tclust,
mlr_learners_clust.xmeans
# Define the Learner and set parameter values learner = lrn("clust.kmeans_rcpp") 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_rcpp") 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-modes clustering for categorical data.
Calls klaR::kmodes() from package klaR.
All feature values are treated as categories.
Numeric features are accepted, but klaR::kmodes() warns when they contain more than 30 distinct values.
The modes parameter is set to 2 by default since klaR::kmodes() does not have a default value for the number of
clusters.
Since klaR::kmodes() does not provide a predict method, new observations are assigned to their closest learned
mode.
Prediction always uses unweighted simple matching distance, including for models trained with weighted = TRUE.
ties:
Not an argument of klaR::kmodes(). Controls how ties are broken when assigning observations to their
closest mode during prediction.
This mlr3::Learner can be instantiated via the dictionary mlr3::mlr_learners or with the associated sugar function mlr3::lrn():
mlr_learners$get("clust.kmodes")
lrn("clust.kmodes")
Task type: “clust”
Predict Types: “partition”
Feature Types: “logical”, “integer”, “numeric”, “factor”, “ordered”
Required Packages: mlr3, mlr3cluster, klaR
| Id | Type | Default | Levels | Range |
| modes | untyped | - | - | |
| iter.max | integer | 10 | |
|
| weighted | logical | FALSE | TRUE, FALSE | - |
| fast | logical | TRUE | TRUE, FALSE | - |
| ties | character | first | first, last, random | - |
mlr3::Learner -> LearnerClust -> LearnerClustKModes
LearnerClustKModes$new()Creates a new instance of this R6 class.
LearnerClustKModes$new()
LearnerClustKModes$clone()The objects of this class are cloneable with this method.
LearnerClustKModes$clone(deep = FALSE)
deepWhether to make a deep clone.
Huang, Zhexue (1997). “A Fast Clustering Algorithm to Cluster Very Large Categorical Data Sets in Data Mining.” In Data Mining: Techniques and Applications, 21–34.
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.
Package mlr3viz for some generic visualizations.
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.flexmix,
mlr_learners_clust.genie,
mlr_learners_clust.gmeans,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kcca,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kmeans_rcpp,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.movMF,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.skmeans,
mlr_learners_clust.som,
mlr_learners_clust.specc,
mlr_learners_clust.stdbscan,
mlr_learners_clust.tclust,
mlr_learners_clust.xmeans
# Define the learner learner = lrn("clust.kmodes", modes = 2L) # Define a categorical task data = data.frame( color = factor(c("red", "red", "blue", "blue")), shape = factor(c("round", "round", "square", "square")) ) task = as_task_clust(data) # Train and predict learner$train(task) prediction = learner$predict(task)# Define the learner learner = lrn("clust.kmodes", modes = 2L) # Define a categorical task data = data.frame( color = factor(c("red", "red", "blue", "blue")), shape = factor(c("round", "round", "square", "square")) ) task = as_task_clust(data) # Train and predict learner$train(task) prediction = learner$predict(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.
The task must have at least 2 features.
keep.data:
Actual default: TRUE.
Adjusted default: FALSE.
Reason for change: Avoid storing the training data in the model to save memory.
verbose:
Actual default: TRUE.
Adjusted default: FALSE.
Reason for change: Suppress verbose output during training.
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 | - |
| keep.data | logical | TRUE | TRUE, FALSE | - |
| verbose | logical | TRUE | TRUE, FALSE | - |
| init | character | NULL | nbh.dens, sel.cen, nstart.m | - |
| p_nstart.m | numeric | 0.9 |
|
mlr3::Learner -> LearnerClust -> LearnerClustKProto
LearnerClustKProto$new()Creates a new instance of this R6 class.
LearnerClustKProto$new()
LearnerClustKProto$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.
Package mlr3viz for some generic visualizations.
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.flexmix,
mlr_learners_clust.genie,
mlr_learners_clust.gmeans,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kcca,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kmeans_rcpp,
mlr_learners_clust.kmodes,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.movMF,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.skmeans,
mlr_learners_clust.som,
mlr_learners_clust.specc,
mlr_learners_clust.stdbscan,
mlr_learners_clust.tclust,
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_KMeans() on the fitted centroids 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 | - | |
|
| 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 | |
|
| threads | integer | 1 |
|
mlr3::Learner -> LearnerClust -> LearnerClustMiniBatchKMeans
LearnerClustMiniBatchKMeans$new()Creates a new instance of this R6 class.
LearnerClustMiniBatchKMeans$new()
LearnerClustMiniBatchKMeans$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.
Package mlr3viz for some generic visualizations.
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.flexmix,
mlr_learners_clust.genie,
mlr_learners_clust.gmeans,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kcca,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kmeans_rcpp,
mlr_learners_clust.kmodes,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.movMF,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.skmeans,
mlr_learners_clust.som,
mlr_learners_clust.specc,
mlr_learners_clust.stdbscan,
mlr_learners_clust.tclust,
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.
verbose:
Actual default: interactive().
Adjusted default: FALSE.
Reason for change: Suppress progress output during training.
warn:
Actual default: mclust.options("warn"), which is FALSE by default.
Adjusted default: FALSE.
Reason for change: Suppress warnings during training independently of the mclust global options.
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 | NULL | |
| prior | untyped | NULL | |
| control | untyped | - | |
| initialization | untyped | NULL | |
| warn | logical | FALSE | TRUE, FALSE |
| x | untyped | NULL | |
| verbose | logical | FALSE | TRUE, FALSE |
mlr3::Learner -> LearnerClust -> LearnerClustMclust
LearnerClustMclust$new()Creates a new instance of this R6 class.
LearnerClustMclust$new()
LearnerClustMclust$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.
Package mlr3viz for some generic visualizations.
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.flexmix,
mlr_learners_clust.genie,
mlr_learners_clust.gmeans,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kcca,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kmeans_rcpp,
mlr_learners_clust.kmodes,
mlr_learners_clust.kproto,
mlr_learners_clust.meanshift,
mlr_learners_clust.movMF,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.skmeans,
mlr_learners_clust.som,
mlr_learners_clust.specc,
mlr_learners_clust.stdbscan,
mlr_learners_clust.tclust,
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.
The predict method runs the mean-shift iteration from each new observation with the trained bandwidth via
LPCM::ms.rep() and assigns it to the mode it converges to, i.e. the basin of attraction of the fitted modes.
plot:
Actual default: TRUE.
Adjusted default: FALSE.
Reason for change: Suppress plotting during training.
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 -> LearnerClust -> LearnerClustMeanShift
LearnerClustMeanShift$new()Creates a new instance of this R6 class.
LearnerClustMeanShift$new()
LearnerClustMeanShift$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.
Package mlr3viz for some generic visualizations.
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.flexmix,
mlr_learners_clust.genie,
mlr_learners_clust.gmeans,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kcca,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kmeans_rcpp,
mlr_learners_clust.kmodes,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.movMF,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.skmeans,
mlr_learners_clust.som,
mlr_learners_clust.specc,
mlr_learners_clust.stdbscan,
mlr_learners_clust.tclust,
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)
Fits a mixture of von Mises-Fisher distributions via EM, the directional-data analogue of a Gaussian mixture for
points on the unit hypersphere.
Calls movMF::movMF() from package movMF.
The k parameter is set to 2 by default since movMF::movMF() has no default value for the number of mixture
components. Rows of x are standardised to unit length internally by movMF::movMF(). Predictions use the
predict() method from movMF; prob returns the soft memberships.
Setting ids initializes the EM algorithm from fixed component memberships and stops it after a single iteration,
in which case movMF::movMF() ignores start and nruns.
This mlr3::Learner can be instantiated via the dictionary mlr3::mlr_learners or with the associated sugar function mlr3::lrn():
mlr_learners$get("clust.movMF")
lrn("clust.movMF")
Task type: “clust”
Predict Types: “partition”, “prob”
Feature Types: “logical”, “integer”, “numeric”
Required Packages: mlr3, mlr3cluster, movMF
| Id | Type | Default | Levels | Range |
| k | integer | - | |
|
| E | character | softmax | softmax, hardmax, stochmax | - |
| kappa | untyped | - | - | |
| ids | untyped | - | - | |
| start | untyped | "p" | - | |
| nruns | integer | 1 | |
|
| maxiter | integer | 100 | |
|
| reltol | numeric | - | |
|
| minalpha | numeric | 0 | |
|
| converge | logical | - | TRUE, FALSE | - |
| verbose | logical | FALSE | TRUE, FALSE | - |
mlr3::Learner -> LearnerClust -> LearnerClustMovMF
LearnerClustMovMF$new()Creates a new instance of this R6 class.
LearnerClustMovMF$new()
LearnerClustMovMF$clone()The objects of this class are cloneable with this method.
LearnerClustMovMF$clone(deep = FALSE)
deepWhether to make a deep clone.
Banerjee, Arindam, Dhillon, S I, Ghosh, Joydeep, Sra, Suvrit (2005). “Clustering on the Unit Hypersphere using von Mises-Fisher Distributions.” Journal of Machine Learning Research, 6(46), 1345–1382.
Hornik, Kurt, Grün, Bettina (2014). “movMF: An R Package for Fitting Mixtures of von Mises-Fisher Distributions.” Journal of Statistical Software, 58(10), 1–31. doi:10.18637/jss.v058.i10.
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.
Package mlr3viz for some generic visualizations.
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.flexmix,
mlr_learners_clust.genie,
mlr_learners_clust.gmeans,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kcca,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kmeans_rcpp,
mlr_learners_clust.kmodes,
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.skmeans,
mlr_learners_clust.som,
mlr_learners_clust.specc,
mlr_learners_clust.stdbscan,
mlr_learners_clust.tclust,
mlr_learners_clust.xmeans
# Define the Learner and set parameter values learner = lrn("clust.movMF") 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.movMF") 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 | Inf | |
|
| 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 -> LearnerClust -> LearnerClustOPTICS
LearnerClustOPTICS$new()Creates a new instance of this R6 class.
LearnerClustOPTICS$new()
LearnerClustOPTICS$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.
Package mlr3viz for some generic visualizations.
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.flexmix,
mlr_learners_clust.genie,
mlr_learners_clust.gmeans,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kcca,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kmeans_rcpp,
mlr_learners_clust.kmodes,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.movMF,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.skmeans,
mlr_learners_clust.som,
mlr_learners_clust.specc,
mlr_learners_clust.stdbscan,
mlr_learners_clust.tclust,
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.
keep.diss:
Actual default: n < 100, where n is the number of observations.
Adjusted default: FALSE.
Reason for change: Avoid storing the dissimilarity matrix in the model to save memory.
keep.data:
Actual default: TRUE.
Adjusted default: FALSE.
Reason for change: Avoid storing the training data in the model to save memory.
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 | - | |
|
| stand | logical | FALSE | TRUE, FALSE | - |
| do.swap | logical | TRUE | TRUE, FALSE | - |
| keep.diss | logical | - | TRUE, FALSE | - |
| keep.data | 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 -> LearnerClust -> LearnerClustPAM
LearnerClustPAM$new()Creates a new instance of this R6 class.
LearnerClustPAM$new()
LearnerClustPAM$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.
Package mlr3viz for some generic visualizations.
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.flexmix,
mlr_learners_clust.genie,
mlr_learners_clust.gmeans,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kcca,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kmeans_rcpp,
mlr_learners_clust.kmodes,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.movMF,
mlr_learners_clust.optics,
mlr_learners_clust.protoclust,
mlr_learners_clust.skmeans,
mlr_learners_clust.som,
mlr_learners_clust.specc,
mlr_learners_clust.stdbscan,
mlr_learners_clust.tclust,
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.
The predict method cuts the tree at the current k via protoclust::protocut() and assigns each new observation
to the cluster of its nearest prototype, using the same distance method as during training. The model is therefore
a list containing the fitted protoclust::protoclust() object along with the training data.
k:
Not an argument of protoclust::protoclust(). The number of clusters to cut the tree into,
passed to protoclust::protocut(). Initialized to 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.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 | - |
|
mlr3::Learner -> LearnerClust -> LearnerClustProtoclust
native_model(any)
The fitted model.
LearnerClustProtoclust$new()Creates a new instance of this R6 class.
LearnerClustProtoclust$new()
LearnerClustProtoclust$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.
Package mlr3viz for some generic visualizations.
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.flexmix,
mlr_learners_clust.genie,
mlr_learners_clust.gmeans,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kcca,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kmeans_rcpp,
mlr_learners_clust.kmodes,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.movMF,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.skmeans,
mlr_learners_clust.som,
mlr_learners_clust.specc,
mlr_learners_clust.stdbscan,
mlr_learners_clust.tclust,
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 | 500 | |
|
| init | integer | 0 | |
|
| M | logical | FALSE | TRUE, FALSE | - |
| max_candidates | integer | 100 | |
|
| min_density | numeric | 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.25 | |
|
| V | logical | FALSE | TRUE, FALSE | - |
| output_debug_info | logical | FALSE | TRUE, FALSE | - |
| do_not_check_capabilities | logical | FALSE | TRUE, FALSE | - |
mlr3::Learner -> LearnerClust -> LearnerClustSimpleKMeans
marshaled(logical(1))
Whether the learner's model is marshaled.
LearnerClustSimpleKMeans$new()Creates a new instance of this R6 class.
LearnerClustSimpleKMeans$new()
LearnerClustSimpleKMeans$marshal()Marshal the learner's model.
LearnerClustSimpleKMeans$marshal(...)
...(any)
Additional arguments passed to mlr3::marshal_model().
LearnerClustSimpleKMeans$unmarshal()Unmarshal the learner's model.
LearnerClustSimpleKMeans$unmarshal(...)
...(any)
Additional arguments passed to mlr3::unmarshal_model().
LearnerClustSimpleKMeans$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.
Package mlr3viz for some generic visualizations.
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.flexmix,
mlr_learners_clust.genie,
mlr_learners_clust.gmeans,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kcca,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kmeans_rcpp,
mlr_learners_clust.kmodes,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.movMF,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.skmeans,
mlr_learners_clust.som,
mlr_learners_clust.specc,
mlr_learners_clust.stdbscan,
mlr_learners_clust.tclust,
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)
Spherical k-means clustering for data on the unit hypersphere.
Calls skmeans::skmeans() from package skmeans.
The k parameter is set to 2 by default since skmeans::skmeans() doesn't have a default value for the number of
clusters.
Observations are partitioned by maximising cosine similarity to cluster prototypes. Predictions on new data assign
each observation to the prototype with the highest cosine similarity. Rows with zero norm are not allowed by
skmeans::skmeans().
This mlr3::Learner can be instantiated via the dictionary mlr3::mlr_learners or with the associated sugar function mlr3::lrn():
mlr_learners$get("clust.skmeans")
lrn("clust.skmeans")
Task type: “clust”
Predict Types: “partition”
Feature Types: “logical”, “integer”, “numeric”
Required Packages: mlr3, mlr3cluster, skmeans
| Id | Type | Default | Levels | Range |
| k | integer | - | |
|
| method | character | - | genetic, pclust, CLUTO, gmeans, kmndirs, LIH, LIHC | - |
| m | numeric | 1 | |
|
| weights | untyped | 1 | - | |
| start | untyped | "p" | - | |
| maxiter | integer | - | |
|
| nruns | integer | - | |
|
| maxchains | integer | - | |
|
| popsize | integer | - | |
|
| mutations | numeric | - | |
|
| reltol | numeric | - | |
|
| verbose | logical | - | TRUE, FALSE | - |
mlr3::Learner -> LearnerClust -> LearnerClustSKMeans
LearnerClustSKMeans$new()Creates a new instance of this R6 class.
LearnerClustSKMeans$new()
LearnerClustSKMeans$clone()The objects of this class are cloneable with this method.
LearnerClustSKMeans$clone(deep = FALSE)
deepWhether to make a deep clone.
Dhillon, S I, Modha, S D (2001). “Concept decompositions for large sparse text data using clustering.” Machine Learning, 42(1), 143–175. doi:10.1023/A:1007612920971.
Hornik, Kurt, Feinerer, Ingo, Kober, Martin, Buchta, Christian (2012). “Spherical k-Means Clustering.” Journal of Statistical Software, 50(10), 1–22. doi:10.18637/jss.v050.i10.
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.
Package mlr3viz for some generic visualizations.
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.flexmix,
mlr_learners_clust.genie,
mlr_learners_clust.gmeans,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kcca,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kmeans_rcpp,
mlr_learners_clust.kmodes,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.movMF,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.som,
mlr_learners_clust.specc,
mlr_learners_clust.stdbscan,
mlr_learners_clust.tclust,
mlr_learners_clust.xmeans
# Define the Learner and set parameter values learner = lrn("clust.skmeans") 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.skmeans") 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)
Self-organizing map (Kohonen network) clustering.
Calls kohonen::som() from package kohonen.
Each map unit corresponds to a cluster, so the number of clusters is xdim * ydim. The predict method
uses kohonen::map() to assign new data to the closest unit.
xdim, ydim, topo, neighbourhood.fct, toroidal:
Not arguments of kohonen::som(). These construct the map grid and are forwarded to kohonen::somgrid().
cores:
Actual default: -1L, using all available cores.
Adjusted default: 1L.
Reason for change: Conflicting with parallelization via future.
This mlr3::Learner can be instantiated via the dictionary mlr3::mlr_learners or with the associated sugar function mlr3::lrn():
mlr_learners$get("clust.som")
lrn("clust.som")
Task type: “clust”
Predict Types: “partition”
Feature Types: “logical”, “integer”, “numeric”
Required Packages: mlr3, mlr3cluster, kohonen
| Id | Type | Default | Levels | Range |
| xdim | integer | 8 | |
|
| ydim | integer | 6 | |
|
| topo | character | rectangular | rectangular, hexagonal | - |
| neighbourhood.fct | character | bubble | bubble, gaussian | - |
| toroidal | logical | FALSE | TRUE, FALSE | - |
| rlen | integer | 100 | |
|
| alpha | untyped | c(0.05, 0.01) | - | |
| radius | untyped | - | - | |
| user.weights | untyped | 1 | - | |
| maxNA.fraction | numeric | 0 | |
|
| keep.data | logical | TRUE | TRUE, FALSE | - |
| dist.fcts | untyped | NULL | - | |
| mode | character | online | online, batch, pbatch | - |
| cores | integer | -1 | |
|
| init | untyped | - | - | |
| normalizeDataLayers | logical | TRUE | TRUE, FALSE | - |
mlr3::Learner -> LearnerClust -> LearnerClustSOM
LearnerClustSOM$new()Creates a new instance of this R6 class.
LearnerClustSOM$new()
LearnerClustSOM$clone()The objects of this class are cloneable with this method.
LearnerClustSOM$clone(deep = FALSE)
deepWhether to make a deep clone.
Kohonen, Teuvo (1990). “The self-organizing map.” Proceedings of the IEEE, 78(9), 1464–1480. doi:10.1109/5.58325.
Wehrens, Ron, Kruisselbrink, Johannes (2018). “Flexible self-organizing maps in kohonen 3.0.” Journal of Statistical Software, 87(7), 1–18. doi:10.18637/jss.v087.i07.
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.
Package mlr3viz for some generic visualizations.
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.flexmix,
mlr_learners_clust.genie,
mlr_learners_clust.gmeans,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kcca,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kmeans_rcpp,
mlr_learners_clust.kmodes,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.movMF,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.skmeans,
mlr_learners_clust.specc,
mlr_learners_clust.stdbscan,
mlr_learners_clust.tclust,
mlr_learners_clust.xmeans
# Define the Learner and set parameter values learner = lrn("clust.som") 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.som") 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.
There is no predict method for kernlab::specc(), so the method returns cluster labels for the training data.
sigma, degree, scale, offset, order:
In kernlab::specc(), these kernel parameters are passed inside the kpar list. Here they are exposed
directly and assembled into kpar internally.
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 | 1 | |
|
| 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 -> LearnerClust -> LearnerClustSpectral
LearnerClustSpectral$new()Creates a new instance of this R6 class.
LearnerClustSpectral$new()
LearnerClustSpectral$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.
Package mlr3viz for some generic visualizations.
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.flexmix,
mlr_learners_clust.genie,
mlr_learners_clust.gmeans,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kcca,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kmeans_rcpp,
mlr_learners_clust.kmodes,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.movMF,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.skmeans,
mlr_learners_clust.som,
mlr_learners_clust.stdbscan,
mlr_learners_clust.tclust,
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)
ST-DBSCAN (spatio-temporal density-based spatial clustering of applications with noise) clustering.
Calls stdbscan::st_dbscan() from package stdbscan.
The task must have exactly 3 features: the first two features (in the task's feature order, which is alphabetical for newly created tasks) are used as the spatial coordinates and the third feature as the temporal coordinate.
This mlr3::Learner can be instantiated via the dictionary mlr3::mlr_learners or with the associated sugar function mlr3::lrn():
mlr_learners$get("clust.stdbscan")
lrn("clust.stdbscan")
Task type: “clust”
Predict Types: “partition”
Feature Types: “integer”, “numeric”
Required Packages: mlr3, mlr3cluster, stdbscan
| Id | Type | Default | Levels | Range |
| eps_spatial | numeric | - | |
|
| eps_temporal | numeric | - | |
|
| min_pts | integer | - | |
|
| weights | untyped | NULL | - | |
| 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 -> LearnerClust -> LearnerClustSTDBSCAN
LearnerClustSTDBSCAN$new()Creates a new instance of this R6 class.
LearnerClustSTDBSCAN$new()
LearnerClustSTDBSCAN$clone()The objects of this class are cloneable with this method.
LearnerClustSTDBSCAN$clone(deep = FALSE)
deepWhether to make a deep clone.
Birant, Derya, Kut, Alp (2007). “ST-DBSCAN: An algorithm for clustering spatial-temporal data.” Data & Knowledge Engineering, 60(1), 208–221. doi:10.1016/j.datak.2006.01.013.
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.
Package mlr3viz for some generic visualizations.
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.flexmix,
mlr_learners_clust.genie,
mlr_learners_clust.gmeans,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kcca,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kmeans_rcpp,
mlr_learners_clust.kmodes,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.movMF,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.skmeans,
mlr_learners_clust.som,
mlr_learners_clust.specc,
mlr_learners_clust.tclust,
mlr_learners_clust.xmeans
# Define the Learner and set parameter values learner = lrn("clust.stdbscan") print(learner)# Define the Learner and set parameter values learner = lrn("clust.stdbscan") print(learner)
Robust trimmed clustering. Each cluster is modeled by a multivariate Gaussian; the most
outlying alpha fraction of observations is trimmed and labeled with cluster 0 in the returned partition.
Calls tclust::tclust() from package tclust.
The k parameter is set to 2 by default since tclust::tclust() doesn't have a default value for the number of
clusters. There is no predict method for tclust::tclust(), so the method returns cluster labels for the training
data.
Setting n.cores to a value greater than one enables parallel at train time unless it is set explicitly.
store_x:
Actual default: TRUE.
Adjusted default: FALSE.
Reason for change: Avoid storing the training data in the model to save memory.
n.cores:
Actual default: -1L, using all available cores.
Adjusted default: 1L.
Reason for change: Conflicting with parallelization via future.
This mlr3::Learner can be instantiated via the dictionary mlr3::mlr_learners or with the associated sugar function mlr3::lrn():
mlr_learners$get("clust.tclust")
lrn("clust.tclust")
Task type: “clust”
Predict Types: “partition”
Feature Types: “logical”, “integer”, “numeric”
Required Packages: mlr3, mlr3cluster, tclust
| Id | Type | Default | Levels | Range |
| k | integer | - | |
|
| alpha | numeric | 0.05 | |
|
| nstart | integer | 500 | |
|
| niter1 | integer | 3 | |
|
| niter2 | integer | 20 | |
|
| nkeep | integer | 5 | |
|
| equal.weights | logical | FALSE | TRUE, FALSE | - |
| restr | character | eigen | eigen, deter | - |
| restr.fact | numeric | 12 | |
|
| cshape | numeric | 1e+10 | |
|
| opt | character | HARD | HARD, MIXT | - |
| center | logical | FALSE | TRUE, FALSE | - |
| scale | logical | FALSE | TRUE, FALSE | - |
| store_x | logical | TRUE | TRUE, FALSE | - |
| parallel | logical | FALSE | TRUE, FALSE | - |
| n.cores | integer | -1 | |
|
| zero_tol | numeric | 1e-16 | |
|
| drop.empty.clust | logical | TRUE | TRUE, FALSE | - |
| trace | integer | 0 |
|
mlr3::Learner -> LearnerClust -> LearnerClustTclust
LearnerClustTclust$new()Creates a new instance of this R6 class.
LearnerClustTclust$new()
LearnerClustTclust$clone()The objects of this class are cloneable with this method.
LearnerClustTclust$clone(deep = FALSE)
deepWhether to make a deep clone.
García-Escudero, A L, Gordaliza, Alfonso, Matrán, Carlos, Mayo-Iscar, Agustín (2008). “A general trimming approach to robust cluster analysis.” The Annals of Statistics, 36(3), 1324–1345. doi:10.1214/07-AOS515.
Fritz, Heinrich, García-Escudero, A L, Mayo-Iscar, Agustín (2012). “tclust: An R package for a trimming approach to cluster analysis.” Journal of Statistical Software, 47(12), 1–26. doi:10.18637/jss.v047.i12.
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.
Package mlr3viz for some generic visualizations.
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.flexmix,
mlr_learners_clust.genie,
mlr_learners_clust.gmeans,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kcca,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kmeans_rcpp,
mlr_learners_clust.kmodes,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.movMF,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.skmeans,
mlr_learners_clust.som,
mlr_learners_clust.specc,
mlr_learners_clust.stdbscan,
mlr_learners_clust.xmeans
# Define the Learner and set parameter values learner = lrn("clust.tclust") 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.tclust") 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.
XMeans is not part of the Weka core and must be installed once through the Weka package manager:
RWeka::WPM("refresh-cache")
RWeka::WPM("install-package", "XMeans")
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.5 | |
|
| 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 | - |
| do_not_check_capabilities | logical | FALSE | TRUE, FALSE | - |
mlr3::Learner -> LearnerClust -> LearnerClustXMeans
LearnerClustXMeans$new()Creates a new instance of this R6 class.
LearnerClustXMeans$new()
LearnerClustXMeans$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.
Package mlr3viz for some generic visualizations.
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.flexmix,
mlr_learners_clust.genie,
mlr_learners_clust.gmeans,
mlr_learners_clust.hclust,
mlr_learners_clust.hdbscan,
mlr_learners_clust.kcca,
mlr_learners_clust.kkmeans,
mlr_learners_clust.kmeans,
mlr_learners_clust.kmeans_rcpp,
mlr_learners_clust.kmodes,
mlr_learners_clust.kproto,
mlr_learners_clust.mclust,
mlr_learners_clust.meanshift,
mlr_learners_clust.movMF,
mlr_learners_clust.optics,
mlr_learners_clust.pam,
mlr_learners_clust.protoclust,
mlr_learners_clust.skmeans,
mlr_learners_clust.som,
mlr_learners_clust.specc,
mlr_learners_clust.stdbscan,
mlr_learners_clust.tclust
# 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 mean of all pairwise distances between observations belonging to different clusters. Higher values indicate greater separation between clusters. This measure is scale-dependent and is most useful for comparing clusterings of the same dataset.
If the task contains character, factor, or ordered features, Gower distances (cluster::daisy()) are used instead of
Euclidean distances.
This mlr3::Measure can be instantiated via the dictionary mlr3::mlr_measures or with the
associated sugar function mlr3::msr():
mlr_measures$get("clust.avg_between")
msr("clust.avg_between")
Task type: “clust”
Range:
Minimize: FALSE
Average: macro
Required Prediction: “partition”
Required Packages: mlr3, mlr3cluster, cluster
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.avg_within,
mlr_measures_clust.ch,
mlr_measures_clust.davies_bouldin,
mlr_measures_clust.dunn,
mlr_measures_clust.dunn2,
mlr_measures_clust.entropy,
mlr_measures_clust.pearsongamma,
mlr_measures_clust.silhouette,
mlr_measures_clust.sse_ratio,
mlr_measures_clust.wb_ratio,
mlr_measures_clust.wss
The weighted mean of average pairwise distances within each cluster, where weights are the cluster sizes. Lower values indicate more compact clusters. This measure is scale-dependent and is most useful for comparing clusterings of the same dataset.
If the task contains character, factor, or ordered features, Gower distances (cluster::daisy()) are used instead of
Euclidean distances.
This mlr3::Measure can be instantiated via the dictionary mlr3::mlr_measures or with the
associated sugar function mlr3::msr():
mlr_measures$get("clust.avg_within")
msr("clust.avg_within")
Task type: “clust”
Range:
Minimize: TRUE
Average: macro
Required Prediction: “partition”
Required Packages: mlr3, mlr3cluster, cluster
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.avg_between,
mlr_measures_clust.ch,
mlr_measures_clust.davies_bouldin,
mlr_measures_clust.dunn,
mlr_measures_clust.dunn2,
mlr_measures_clust.entropy,
mlr_measures_clust.pearsongamma,
mlr_measures_clust.silhouette,
mlr_measures_clust.sse_ratio,
mlr_measures_clust.wb_ratio,
mlr_measures_clust.wss
The Calinski-Harabasz index (also known as the Variance Ratio Criterion) is the ratio of between-cluster variance
to within-cluster variance, adjusted for the number of clusters and observations. It is defined as
where is the between-cluster scatter matrix, is the within-cluster scatter matrix, is
the number of clusters, and is the number of observations. Higher values indicate better-defined clusters.
This mlr3::Measure can be instantiated via the dictionary mlr3::mlr_measures or with the
associated sugar function mlr3::msr():
mlr_measures$get("clust.ch")
msr("clust.ch")
Task type: “clust”
Range:
Minimize: FALSE
Average: macro
Required Prediction: “partition”
Required Packages: mlr3, mlr3cluster
Caliński, Tadeusz, Harabasz, Jerzy (1974). “A dendrite method for cluster analysis.” Communications in Statistics, 3(1), 1–27. doi:10.1080/03610927408827101.
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.avg_between,
mlr_measures_clust.avg_within,
mlr_measures_clust.davies_bouldin,
mlr_measures_clust.dunn,
mlr_measures_clust.dunn2,
mlr_measures_clust.entropy,
mlr_measures_clust.pearsongamma,
mlr_measures_clust.silhouette,
mlr_measures_clust.sse_ratio,
mlr_measures_clust.wb_ratio,
mlr_measures_clust.wss
The Davies-Bouldin index measures the average similarity between each cluster and the cluster most similar to it,
where similarity is the ratio of within-cluster scatter to between-cluster separation. It is defined as
where is the average distance of observations in cluster to its centroid and
is the Euclidean distance between centroids and . Lower values indicate better
clustering.
This mlr3::Measure can be instantiated via the dictionary mlr3::mlr_measures or with the
associated sugar function mlr3::msr():
mlr_measures$get("clust.davies_bouldin")
msr("clust.davies_bouldin")
Task type: “clust”
Range:
Minimize: TRUE
Average: macro
Required Prediction: “partition”
Required Packages: mlr3, mlr3cluster
Davies, L D, Bouldin, W D (1979). “A cluster separation measure.” IEEE Transactions on Pattern Analysis and Machine Intelligence, PAMI-1(2), 224–227. doi:10.1109/TPAMI.1979.4766909.
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.avg_between,
mlr_measures_clust.avg_within,
mlr_measures_clust.ch,
mlr_measures_clust.dunn,
mlr_measures_clust.dunn2,
mlr_measures_clust.entropy,
mlr_measures_clust.pearsongamma,
mlr_measures_clust.silhouette,
mlr_measures_clust.sse_ratio,
mlr_measures_clust.wb_ratio,
mlr_measures_clust.wss
The Dunn index is the ratio of the smallest inter-cluster distance to the largest intra-cluster diameter, defined
as
where is the minimum distance between clusters and , and
is the maximum distance between any two observations in cluster . Higher
values indicate compact, well-separated clusters.
If the task contains character, factor, or ordered features, Gower distances (cluster::daisy()) are used instead of
Euclidean distances.
This mlr3::Measure can be instantiated via the dictionary mlr3::mlr_measures or with the
associated sugar function mlr3::msr():
mlr_measures$get("clust.dunn")
msr("clust.dunn")
Task type: “clust”
Range:
Minimize: FALSE
Average: macro
Required Prediction: “partition”
Required Packages: mlr3, mlr3cluster, cluster
Dunn, C J (1974). “Well-separated clusters and optimal fuzzy partitions.” Journal of Cybernetics, 4(1), 95–104. doi:10.1080/01969727408546059.
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.avg_between,
mlr_measures_clust.avg_within,
mlr_measures_clust.ch,
mlr_measures_clust.davies_bouldin,
mlr_measures_clust.dunn2,
mlr_measures_clust.entropy,
mlr_measures_clust.pearsongamma,
mlr_measures_clust.silhouette,
mlr_measures_clust.sse_ratio,
mlr_measures_clust.wb_ratio,
mlr_measures_clust.wss
An alternative formulation of the Dunn index that uses average distances instead of extremes. It is defined as the
ratio of the minimum average between-cluster distance to the maximum average within-cluster distance:
.
This variant is more robust to outliers than the standard Dunn index. Higher values indicate better separation.
If the task contains character, factor, or ordered features, Gower distances (cluster::daisy()) are used instead of
Euclidean distances.
This mlr3::Measure can be instantiated via the dictionary mlr3::mlr_measures or with the
associated sugar function mlr3::msr():
mlr_measures$get("clust.dunn2")
msr("clust.dunn2")
Task type: “clust”
Range:
Minimize: FALSE
Average: macro
Required Prediction: “partition”
Required Packages: mlr3, mlr3cluster, cluster
Dunn, C J (1974). “Well-separated clusters and optimal fuzzy partitions.” Journal of Cybernetics, 4(1), 95–104. doi:10.1080/01969727408546059.
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.avg_between,
mlr_measures_clust.avg_within,
mlr_measures_clust.ch,
mlr_measures_clust.davies_bouldin,
mlr_measures_clust.dunn,
mlr_measures_clust.entropy,
mlr_measures_clust.pearsongamma,
mlr_measures_clust.silhouette,
mlr_measures_clust.sse_ratio,
mlr_measures_clust.wb_ratio,
mlr_measures_clust.wss
The Shannon entropy of the cluster size distribution, defined as
where is the proportion of observations in cluster . Lower values indicate more
uneven cluster sizes (with 0 for a single cluster), while higher values indicate more uniform sizes. This measure
does not evaluate cluster quality directly but characterizes the balance of the partition.
This mlr3::Measure can be instantiated via the dictionary mlr3::mlr_measures or with the
associated sugar function mlr3::msr():
mlr_measures$get("clust.entropy")
msr("clust.entropy")
Task type: “clust”
Range:
Minimize: NA
Average: macro
Required Prediction: “partition”
Required Packages: mlr3, mlr3cluster
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.avg_between,
mlr_measures_clust.avg_within,
mlr_measures_clust.ch,
mlr_measures_clust.davies_bouldin,
mlr_measures_clust.dunn,
mlr_measures_clust.dunn2,
mlr_measures_clust.pearsongamma,
mlr_measures_clust.silhouette,
mlr_measures_clust.sse_ratio,
mlr_measures_clust.wb_ratio,
mlr_measures_clust.wss
The Pearson correlation between pairwise distances and a binary indicator of whether two observations belong to different clusters. All within-cluster distances are paired with indicator 0, and all between-cluster distances with indicator 1. Values close to 1 indicate that between-cluster distances tend to be larger than within-cluster distances, suggesting well-separated clusters.
If the task contains character, factor, or ordered features, Gower distances (cluster::daisy()) are used instead of
Euclidean distances.
This mlr3::Measure can be instantiated via the dictionary mlr3::mlr_measures or with the
associated sugar function mlr3::msr():
mlr_measures$get("clust.pearsongamma")
msr("clust.pearsongamma")
Task type: “clust”
Range:
Minimize: FALSE
Average: macro
Required Prediction: “partition”
Required Packages: mlr3, mlr3cluster, cluster
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.avg_between,
mlr_measures_clust.avg_within,
mlr_measures_clust.ch,
mlr_measures_clust.davies_bouldin,
mlr_measures_clust.dunn,
mlr_measures_clust.dunn2,
mlr_measures_clust.entropy,
mlr_measures_clust.silhouette,
mlr_measures_clust.sse_ratio,
mlr_measures_clust.wb_ratio,
mlr_measures_clust.wss
Calls cluster::silhouette() from package cluster.
The Silhouette Width measures how well each observation fits within its assigned cluster compared to neighboring
clusters. For each observation, the silhouette value is defined as
where is the average distance to all other observations in the same cluster and is the
minimum average distance to observations in any other cluster. The score returned is the mean silhouette width
across all observations. Values close to 1 indicate well-clustered observations, values near 0 indicate
observations on cluster boundaries, and negative values indicate possible misclassification.
If the task contains character, factor, or ordered features, Gower distances (cluster::daisy()) are used instead of
Euclidean distances.
This mlr3::Measure can be instantiated via the dictionary mlr3::mlr_measures or with the
associated sugar function mlr3::msr():
mlr_measures$get("clust.silhouette")
msr("clust.silhouette")
Task type: “clust”
Range:
Minimize: FALSE
Average: macro
Required Prediction: “partition”
Required Packages: mlr3, mlr3cluster, cluster
Rousseeuw, J P (1987). “Silhouettes: A graphical aid to the interpretation and validation of cluster analysis.” Journal of Computational and Applied Mathematics, 20, 53–65. doi:10.1016/0377-0427(87)90125-7.
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.avg_between,
mlr_measures_clust.avg_within,
mlr_measures_clust.ch,
mlr_measures_clust.davies_bouldin,
mlr_measures_clust.dunn,
mlr_measures_clust.dunn2,
mlr_measures_clust.entropy,
mlr_measures_clust.pearsongamma,
mlr_measures_clust.sse_ratio,
mlr_measures_clust.wb_ratio,
mlr_measures_clust.wss
The ratio of the within-cluster sum of squares to the total sum of squares,
where is the centroid of cluster and is the centroid of all observations. The ratio
lies in , with lower values indicating more compact clusters. Unlike the raw within sum of squares, it
is comparable across datasets and feature scalings. It decreases monotonically with the number of clusters, which
makes it the standard quantity for elbow plots.
This mlr3::Measure can be instantiated via the dictionary mlr3::mlr_measures or with the
associated sugar function mlr3::msr():
mlr_measures$get("clust.sse_ratio")
msr("clust.sse_ratio")
Task type: “clust”
Range:
Minimize: TRUE
Average: macro
Required Prediction: “partition”
Required Packages: mlr3, mlr3cluster
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.avg_between,
mlr_measures_clust.avg_within,
mlr_measures_clust.ch,
mlr_measures_clust.davies_bouldin,
mlr_measures_clust.dunn,
mlr_measures_clust.dunn2,
mlr_measures_clust.entropy,
mlr_measures_clust.pearsongamma,
mlr_measures_clust.silhouette,
mlr_measures_clust.wb_ratio,
mlr_measures_clust.wss
The ratio of the average within-cluster distance to the average between-cluster distance. The average within-cluster distance is the weighted mean of all pairwise distances within each cluster, and the average between-cluster distance is the mean of all pairwise distances between observations in different clusters. Lower values indicate compact clusters that are well separated from each other.
If the task contains character, factor, or ordered features, Gower distances (cluster::daisy()) are used instead of
Euclidean distances.
This mlr3::Measure can be instantiated via the dictionary mlr3::mlr_measures or with the
associated sugar function mlr3::msr():
mlr_measures$get("clust.wb_ratio")
msr("clust.wb_ratio")
Task type: “clust”
Range:
Minimize: TRUE
Average: macro
Required Prediction: “partition”
Required Packages: mlr3, mlr3cluster, cluster
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.avg_between,
mlr_measures_clust.avg_within,
mlr_measures_clust.ch,
mlr_measures_clust.davies_bouldin,
mlr_measures_clust.dunn,
mlr_measures_clust.dunn2,
mlr_measures_clust.entropy,
mlr_measures_clust.pearsongamma,
mlr_measures_clust.silhouette,
mlr_measures_clust.sse_ratio,
mlr_measures_clust.wss
The total within-cluster sum of squares measures the compactness of the clustering by summing the squared
Euclidean distances of each observation to its cluster centroid across all clusters:
. Lower values indicate tighter clusters.
This mlr3::Measure can be instantiated via the dictionary mlr3::mlr_measures or with the
associated sugar function mlr3::msr():
mlr_measures$get("clust.wss")
msr("clust.wss")
Task type: “clust”
Range:
Minimize: TRUE
Average: macro
Required Prediction: “partition”
Required Packages: mlr3, mlr3cluster
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.avg_between,
mlr_measures_clust.avg_within,
mlr_measures_clust.ch,
mlr_measures_clust.davies_bouldin,
mlr_measures_clust.dunn,
mlr_measures_clust.dunn2,
mlr_measures_clust.entropy,
mlr_measures_clust.pearsongamma,
mlr_measures_clust.silhouette,
mlr_measures_clust.sse_ratio,
mlr_measures_clust.wb_ratio
A TaskGenerator for isotropic Gaussian blobs, in the spirit of
sklearn.datasets.make_blobs().
k cluster centers are drawn uniformly from the hypercube [-center_box, center_box]^d, and the n
observations are assigned to the centers in a balanced fashion and perturbed with Gaussian noise of standard
deviation sd in each of the d dimensions.
The generated TaskClust only contains the numeric features x1, ..., xd; the cluster membership is not
stored in the task.
The parameters are initialized to k = 3, d = 2, sd = 1, and center_box = 10.
This TaskGenerator can be instantiated via the dictionary mlr_task_generators or with the associated sugar function tgen():
mlr_task_generators$get("blobs")
tgen("blobs")
| Id | Type | Default | Range |
| k | integer | - | |
| d | integer | - | |
| sd | numeric | - | |
| center_box | numeric | - |
|
mlr3::TaskGenerator -> TaskGeneratorBlobs
TaskGeneratorBlobs$new()Creates a new instance of this R6 class.
TaskGeneratorBlobs$new()
TaskGeneratorBlobs$plot()Creates a simple plot of the first two features of generated data, colored by cluster membership.
TaskGeneratorBlobs$plot(n = 200L, pch = 19L, ...)
n(integer(1))
Number of samples to draw for the plot. Default is 200.
pch(integer(1))
Point char. Passed to graphics::plot().
...(any)
Additional arguments passed to graphics::plot().
TaskGeneratorBlobs$clone()The objects of this class are cloneable with this method.
TaskGeneratorBlobs$clone(deep = FALSE)
deepWhether to make a deep clone.
as.data.table(mlr_task_generators) for a table of available TaskGenerators in the
running session (depending on the loaded packages).
Other TaskGenerator:
mlr_task_generators_moons
generator = tgen("blobs") plot(generator, n = 200) task = generator$generate(200) str(task$data()) # 4 well separated clusters in 3 dimensions generator = tgen("blobs", k = 4, d = 3, sd = 0.5) task = generator$generate(500) taskgenerator = tgen("blobs") plot(generator, n = 200) task = generator$generate(200) str(task$data()) # 4 well separated clusters in 3 dimensions generator = tgen("blobs", k = 4, d = 3, sd = 0.5) task = generator$generate(500) task
A TaskGenerator for two interleaving half circles ("moons"), in the spirit of
sklearn.datasets.make_moons().
The n observations are split evenly between an upper half circle centered at the origin and a lower half circle
shifted to the right and down so that the two arcs interleave.
Each observation is perturbed with Gaussian noise of standard deviation sd.
The generated TaskClust only contains the numeric features x1 and x2; the cluster membership is not
stored in the task.
The parameter sd is initialized to 0.1.
The clusters are not convex, which makes this generator a standard test case for density-based and connectivity-based methods such as DBSCAN, single linkage or spectral clustering, where centroid-based methods such as k-means fail.
This TaskGenerator can be instantiated via the dictionary mlr_task_generators or with the associated sugar function tgen():
mlr_task_generators$get("moons")
tgen("moons")
| Id | Type | Default | Range |
| sd | numeric | - |
|
mlr3::TaskGenerator -> TaskGeneratorMoons
TaskGeneratorMoons$new()Creates a new instance of this R6 class.
TaskGeneratorMoons$new()
TaskGeneratorMoons$plot()Creates a simple plot of generated data, colored by cluster membership.
TaskGeneratorMoons$plot(n = 200L, pch = 19L, ...)
n(integer(1))
Number of samples to draw for the plot. Default is 200.
pch(integer(1))
Point char. Passed to graphics::plot().
...(any)
Additional arguments passed to graphics::plot().
TaskGeneratorMoons$clone()The objects of this class are cloneable with this method.
TaskGeneratorMoons$clone(deep = FALSE)
deepWhether to make a deep clone.
as.data.table(mlr_task_generators) for a table of available TaskGenerators in the
running session (depending on the loaded packages).
Other TaskGenerator:
mlr_task_generators_blobs
generator = tgen("moons") plot(generator, n = 200) task = generator$generate(200) str(task$data())generator = tgen("moons") plot(generator, n = 200) task = generator$generate(200) str(task$data())
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 "state" 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.
PredictionClust$new()Creates a new instance of this R6 class.
PredictionClust$new( task = NULL, row_ids = task$row_ids, partition = NULL, prob = NULL, weights = NULL, check = TRUE, extra = NULL, raw = NULL )
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: each observation is assigned the cluster label (column name) of its most
probable cluster, with ties broken by the first maximum.
weights(numeric())
Vector of measure weights for each observation. Should be constructed from the TaskClust's
weights_measure column.
check(logical(1))
If TRUE, performs some argument checks and predict type conversions.
extra(list())
List of extra data to be stored in the prediction object.
raw(any)
Raw prediction object from the upstream model. Stored as-is without validation.
PredictionClust$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.featureless", num_clusters = 2L) p = learner$train(task)$predict(task) p$predict_types head(as.data.table(p))library(mlr3) library(mlr3cluster) task = tsk("usarrests") learner = lrn("clust.featureless", num_clusters = 2L) 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$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()TaskClust$new()Creates a new instance of this R6 class.
TaskClust$new(id, backend, label = NA_character_, extra_args = list())
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.
extra_args(named list())
Named list of constructor arguments, required for converting task types
via mlr3::convert_task().
TaskClust$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