Visualize model as interactive surface
VisualizerSurfaceModel.RdThis class is used to create interactive 3D surface visualizations of learners and tasks for 2D input data using plotly.
Super classes
vistool::Visualizer -> vistool::VisualizerSurface -> VisualizerSurfaceModel
Public fields
task(
mlr3::Task)
Task used to train the model.learner(
mlr3::Learner)
Learner used to train the model.
Methods
Inherited methods
vistool::Visualizer$add_annotation()vistool::Visualizer$add_points()vistool::Visualizer$resolve_layer_colors()vistool::Visualizer$save()vistool::Visualizer$set_theme()vistool::Visualizer$theme()vistool::VisualizerSurface$add_contours()vistool::VisualizerSurface$init_layer_contour()vistool::VisualizerSurface$init_layer_surface()vistool::VisualizerSurface$set_layout()vistool::VisualizerSurface$set_scene()
Method new()
Creates a new instance of this R6 class.
Usage
VisualizerSurfaceModel$new(
task,
learner,
x1_limits = NULL,
x2_limits = NULL,
padding = 0,
n_points = 100L,
hypothesis = NULL,
domain = NULL,
retrain = TRUE
)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.x1_limits(
numeric(2))
The x1 limits.x2_limits(
numeric(2))
The x2 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 bymax(x1lmits) - min(x1limits) * padding.padding(
numeric(1))
A margin that is added to x1limits and x2limits. The x1 margin is calculated bymax(x1lmits) - min(x1limits) * padding.n_points(
integer(1))
The number of generated point per dimension. Note that a grid ofnpoints^2values is generated and evaluated byobjective$eval(x)to plot the surface.n_points(
integer(1))
The number of generated point per dimension. Note that a grid ofnpoints^2values is generated and evaluated byobjective$eval(x)to plot the surface.hypothesis(
Hypothesis|NULL) Optional hypothesis used instead of a learnerdomain(
list|NULL) Domain limits when visualizing a hypothesis without a taskretrain(
logical(1)) Whether to retrain the learner if it has already been trained on the task. Default isTRUE.
Method add_training_data()
Adds the training data to the plot.
Arguments
size(
numeric(1))
Size of the points. If NULL, uses theme$point_size. Default is NULL.color(
character(1)or namedcharacter)
Color of the points. For classification tasks:character(1): A single color for all points (e.g.,"blue") or"auto"for automatic color assignment.named character: A vector mapping class labels to colors (e.g.,c(pos = "red", neg = "blue")). For regression tasks, only single colors are supported. Default is"auto".
shape(
numeric(1)or namednumeric)
Shape/symbol of the points. For classification tasks:numeric(1): A single symbol for all points (e.g.,0for circle).named numeric: A vector mapping class labels to symbols (e.g.,c(pos = 0, neg = 1)). For regression tasks, only single symbols are supported. Default is 0 (circle).
...(
any)
Further arguments passed toadd_trace(...).
Method add_boundary()
Adds boundary surface(s) to the plot at specified values.
Arguments
values(
numeric())
Vector of z-values where to draw boundary surfaces. For classification with probability predictions, defaults to 0.5. For regression or response predictions, defaults to the median of predictions.color(
character(1)orlist())
Color specification for boundary surfaces. Default uses a neutral colorscale....(
any)
Further arguments passed toadd_trace(...)oradd_surface(...).
Method plot()
Create and return the plotly plot with model-specific layers.