Skip to contents

A LearnerClust for agglomerative hierarchical clustering implemented in stats::hclust(). Difference Calculation is done by stats::dist()

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.hclust")
lrn("clust.hclust")

Meta Information

  • Task type: “clust”

  • Predict Types: “partition”

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

  • Required Packages: mlr3, mlr3cluster, 'stats'

Parameters

IdTypeDefaultLevelsRange
methodcharactercompleteward.D, ward.D2, single, complete, average, mcquitty, median, centroid-
membersuntypedNULL-
distmethodcharactereuclideaneuclidean, maximum, manhattan, canberra, binary, minkowski-
diaglogicalFALSETRUE, FALSE-
upperlogicalFALSETRUE, FALSE-
pnumeric2\((-\infty, \infty)\)
kinteger2\([1, \infty)\)

References

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 .

Super classes

mlr3::Learner -> mlr3cluster::LearnerClust -> LearnerClustHclust

Methods

Inherited methods


Method new()

Creates a new instance of this R6 class.

Usage


Method clone()

The objects of this class are cloneable with this method.

Usage

LearnerClustHclust$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

# Define the Learner and set parameter values
learner = lrn("clust.hclust")
print(learner)
#> 
#> ── <LearnerClustHclust> (clust.hclust): Agglomerative Hierarchical Clustering ──
#> • Model: -
#> • Parameters: distmethod=euclidean, k=2
#> • Packages: mlr3, mlr3cluster, and stats
#> • Predict Types: [partition]
#> • Feature Types: logical, integer, and numeric
#> • Encapsulation: none (fallback: -)
#> • Properties: complete, exclusive, and hierarchical
#> • 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)
#> 
#> Call:
#> stats::hclust(d = dist)
#> 
#> Cluster method   : complete 
#> Distance         : euclidean 
#> Number of objects: 50 
#> 

# Make predictions for the task
prediction = learner$predict(task)
#> Warning: Learner 'clust.hclust' doesn't predict on new data and predictions may not make sense on new data.

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