autoplot.LearnerClustHierarchical: Plot for Hierarchical Clustering Learners

Description Usage Arguments Value Examples

View source: R/LearnerClustHierarchical.R

Description

Visualize dendrograms for hierarchical clusterers using the package factoextra.

Note that learner-specific plots are experimental and subject to change.

Usage

1
2
## S3 method for class 'LearnerClustHierarchical'
autoplot(object, ...)

Arguments

object

(mlr3cluster::LearnerClustAgnes | mlr3cluster::LearnerClustDiana).

...

(any): Additional arguments, passed down to function factoextra::fviz_dend() in package factoextra.

Value

ggplot2::ggplot() object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
library(mlr3)
library(mlr3cluster)
library(mlr3viz)

task = mlr_tasks$get("usarrests")

# agnes clustering
learner = mlr_learners$get("clust.agnes")
learner$train(task)
autoplot(learner)

# diana clustering
learner = mlr_learners$get("clust.diana")
learner$train(task)
autoplot(learner,
  k = learner$param_set$values$k, rect_fill = TRUE,
  rect = TRUE, rect_border = "red")

mlr3viz documentation built on July 2, 2021, 1:07 a.m.