Skip to contents

A simple LearnerClust which randomly (but evenly) assigns observations to num_clusters partitions (default: 1 partition).

Dictionary

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")

Meta Information

  • Task type: “clust”

  • Predict Types: “partition”, “prob”

  • Feature Types: “logical”, “integer”, “numeric”

  • Required Packages: mlr3, mlr3cluster

Parameters

IdTypeDefaultRange
num_clustersinteger-\([1, \infty)\)

Super classes

mlr3::Learner -> mlr3cluster::LearnerClust -> LearnerClustFeatureless

Methods

Inherited methods


Method new()

Creates a new instance of this R6 class.


Method clone()

The objects of this class are cloneable with this method.

Usage

LearnerClustFeatureless$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

# Define the Learner and set parameter values
learner = lrn("clust.featureless")
print(learner)
#> 
#> ── <LearnerClustFeatureless> (clust.featureless): Featureless Clustering ───────
#> • Model: -
#> • Parameters: num_clusters=1
#> • Packages: mlr3 and mlr3cluster
#> • Predict Types: [partition] and prob
#> • Feature Types: logical, integer, and numeric
#> • Encapsulation: none (fallback: -)
#> • Properties: complete, exclusive, missings, and partitional
#> • Other settings: use_weights = 'error'

# Define a Task
task = tsk("usarrests")

# Train the learner on the task
learner$train(task)

# Print the model
print(learner$model)
#> $clustering
#>  [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
#> [39] 1 1 1 1 1 1 1 1 1 1 1 1
#> 
#> $features
#> [1] "Assault"  "Murder"   "Rape"     "UrbanPop"
#> 
#> attr(,"class")
#> [1] "clust.featureless_model"

# Make predictions for the task
prediction = learner$predict(task)

# Score the predictions
prediction$score(task = task)
#> clust.dunn 
#>        Inf