This Learner specializes mlr3::Learner for cluster problems:
task_typeis set to"clust".Creates mlr3::Predictions of class PredictionClust.
Possible values for
predict_typesare:"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
Methods
Method new()
Creates a new instance of this R6 class.
Usage
LearnerClust$new(
id,
param_set = ps(),
predict_types = "partition",
feature_types = character(),
properties = character(),
packages = character(),
label = NA_character_,
man = NA_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 ofmlr_reflections$learner_predict_types.feature_types(
character())
Feature types the learner operates on. Must be a subset ofmlr_reflections$task_feature_types.properties(
character())
Set of properties of the mlr3::Learner. Must be a subset ofmlr_reflections$learner_properties. The following properties are currently standardized and understood by learners in mlr3:"missings": The learner can handle missing values in the data."weights": The learner supports observation weights."importance": The learner supports extraction of importance scores, i.e. comes with an$importance()extractor function (see section on optional extractors in mlr3::Learner)."selected_features": The learner supports extraction of the set of selected features, i.e. comes with a$selected_features()extractor function (see section on optional extractors in mlr3::Learner)."oob_error": The learner supports extraction of estimated out of bag error, i.e. comes with aoob_error()extractor function (see section on optional extractors in mlr3::Learner).
packages(
character())
Set of required packages. A warning is signaled by the constructor if at least one of the packages is not installed, but loaded (not attached) later on-demand viarequireNamespace().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().
Examples
library(mlr3)
library(mlr3cluster)
ids = mlr_learners$keys("^clust")
ids
#> [1] "clust.MBatchKMeans" "clust.SimpleKMeans" "clust.agnes"
#> [4] "clust.ap" "clust.bico" "clust.birch"
#> [7] "clust.cmeans" "clust.cobweb" "clust.dbscan"
#> [10] "clust.dbscan_fpc" "clust.diana" "clust.em"
#> [13] "clust.fanny" "clust.featureless" "clust.ff"
#> [16] "clust.hclust" "clust.hdbscan" "clust.kkmeans"
#> [19] "clust.kmeans" "clust.mclust" "clust.meanshift"
#> [22] "clust.optics" "clust.pam" "clust.xmeans"
# get a specific learner from mlr_learners:
learner = lrn("clust.kmeans")
print(learner)
#> <LearnerClustKMeans:clust.kmeans>: K-Means
#> * Model: -
#> * Parameters: centers=2
#> * Packages: mlr3, mlr3cluster, stats, clue
#> * Predict Types: [partition]
#> * Feature Types: logical, integer, numeric
#> * Properties: complete, exclusive, partitional