Skip to contents

This class is used to create 2D visualizations of learners and tasks.

Super class

vistool::Visualizer2D -> Visualizer2DModel

Public fields

task

(`mlr3::Task`)
Task used to train the model.

learner

(`mlr3::Learner`)
Learner used to train the model.

Methods

Inherited methods


Method new()

Creates a new instance of this [R6][R6::R6Class] class.

Usage

Visualizer2DModel$new(
  task,
  learner,
  x1_limits = NULL,
  x2_limits = NULL,
  padding = 0,
  n_points = 100L
)

Arguments

task

([mlr3::Task])
The task to train the model on.

learner

([mlr3::Learner])
The learner to train the model with.

x1_limits

(`numeric(2)`)
The x1 limits.

x2_limits

(`numeric(2)`)
The x2 limits.

padding

(`numeric(1)`)
A margin that is added to x1limits and x2limits. The x1 margin is calculated by `max(x1lmits) - min(x1limits) * padding`.

n_points

(`integer(1)`)
The number of generated point per dimension. Note that a grid of `npoints^2` values is generated and evaluated by `objective$eval(x)` to plot the surface.


Method add_training_data()

Adds the training data to the plot.

Usage

Visualizer2DModel$add_training_data(size = 5, color = "grey", ...)

Arguments

size

(`numeric(1)`)
Size of the points.

color

(`character(1)`)
Color of the points.

...

(`any`)
Further arguments passed to `add_trace(...)`.


Method add_decision_boundary()

Adds the decision boundary to the plot.

Usage

Visualizer2DModel$add_decision_boundary(
  threshold = 0.5,
  surfacecolor = list(c(0, 1), c("rgb(176,196,222)", "rgb(160,82,45)")),
  ...
)

Arguments

threshold

(`numeric(1)`)
Threshold for the decision boundary.

surfacecolor

(`list()`)
The coloring of the surface.

...

(`any`)
Further arguments passed to `add_trace(...)`.


Method clone()

The objects of this class are cloneable with this method.

Usage

Visualizer2DModel$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.