autoplot.PredictionClust {mlr3viz}R Documentation

Plots for Cluster Predictions

Description

Visualizations for mlr3cluster::PredictionClust. The argument type controls what kind of plot is drawn. Possible choices are:

Usage

## S3 method for class 'PredictionClust'
autoplot(
  object,
  task,
  row_ids = NULL,
  type = "scatter",
  theme = theme_minimal(),
  ...
)

Arguments

object

(mlr3cluster::PredictionClust).

task

(mlr3cluster::TaskClust).

row_ids

(integer()) Row ids to subset task data to ensure that only the data used to make predictions are shown in plots.

type

(character(1)):
Type of the plot. See description.

theme

(ggplot2::theme())
The ggplot2::theme_minimal() is applied by default to all plots.

...

(ignored).

Value

ggplot2::ggplot().

References

Tang Y, Horikoshi M, Li W (2016). “ggfortify: Unified Interface to Visualize Statistical Result of Popular R Packages.” The R Journal, 8(2), 474–485. doi:10.32614/RJ-2016-060.

Examples

if (requireNamespace("mlr3")) {
  library(mlr3)
  library(mlr3cluster)
  library(mlr3viz)

  task = tsk("usarrests")
  learner = lrn("clust.kmeans", centers = 3)
  object = learner$train(task)$predict(task)

  head(fortify(object))
  autoplot(object, task)
}

[Package mlr3viz version 0.9.0 Index]