This Learner specializes mlr3::Learner for cluster problems:

  • task_type is set to "clust".

  • Creates Predictions of class PredictionClust.

  • Possible values for predict_types are:

    • "partition": Integer indicating the cluster membership.

    • "prob": Probability for belonging to each cluster.

Predefined learners can be found in the mlr3misc::Dictionary mlr3::mlr_learners.

Super class

mlr3::Learner -> LearnerClust

Public fields

assignments

(NULL | vector())
Cluster assignments from learned model.

save_assignments

(logical())
Should assignments for 'train' data be saved in the learner? Default is TRUE.

Methods

Public methods

Inherited methods

Method new()

Creates a new instance of this R6 class.

Usage

LearnerClust$new(
  id,
  param_set = ParamSet$new(),
  predict_types = "partition",
  feature_types = character(),
  properties = character(),
  packages = character()
)

Arguments

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 Learner. Must be a subset of mlr_reflections$learner_properties. The following properties are currently standardized and understood by learners in mlr3:

  • "missings": The learner can handle missing values in the data.

  • "weights": The learner supports observation weights.

  • "importance": The learner supports extraction of importance scores, i.e. comes with an $importance() extractor function (see section on optional extractors in 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 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 Learner).

packages

(character())
Set of required packages. A warning is signaled by the constructor if at least one of the packages is not installed, but loaded (not attached) later on-demand via requireNamespace().


Method reset()

Reset assignments field before calling parent's reset().

Usage

LearnerClust$reset()


Method clone()

The objects of this class are cloneable with this method.

Usage

LearnerClust$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

library(mlr3) library(mlr3cluster) ids = mlr_learners$keys("^clust") ids
#> [1] "clust.agnes" "clust.ap" "clust.cmeans" #> [4] "clust.cobweb" "clust.dbscan" "clust.diana" #> [7] "clust.em" "clust.fanny" "clust.featureless" #> [10] "clust.ff" "clust.hclust" "clust.kkmeans" #> [13] "clust.kmeans" "clust.MBatchKMeans" "clust.meanshift" #> [16] "clust.pam" "clust.SimpleKMeans" "clust.xmeans"
# get a specific learner from mlr_learners: lrn = mlr_learners$get("clust.kmeans") print(lrn)
#> <LearnerClustKMeans:clust.kmeans> #> * Model: - #> * Parameters: centers=2 #> * Packages: stats, clue #> * Predict Type: partition #> * Feature types: logical, integer, numeric #> * Properties: complete, exclusive, partitional