Skip to contents

Abstract surrogate model class.

A surrogate model is used to model the unknown objective function(s) based on all points evaluated so far.

Public fields

learner

(learner)
Arbitrary learner object depending on the subclass.

Active bindings

print_id

(character)
Id used when printing.

archive

(bbotk::Archive | NULL)
bbotk::Archive of the bbotk::OptimInstance.

n_learner

(integer(1))
Returns the number of surrogate models.

cols_x

(character() | NULL)
Column id's of variables that should be used as features. By default, automatically inferred based on the archive.

cols_y

(character() | NULL)
Column id's of variables that should be used as targets. By default, automatically inferred based on the archive.

insample_perf

(numeric())
Surrogate model's current insample performance.

param_set

(paradox::ParamSet)
Set of hyperparameters.

assert_insample_perf

(numeric())
Asserts whether the current insample performance meets the performance threshold.

packages

(character())
Set of required packages. A warning is signaled if at least one of the packages is not installed, but loaded (not attached) later on-demand via requireNamespace().

feature_types

(character())
Stores the feature types the surrogate can handle, e.g. "logical", "numeric", or "factor". A complete list of candidate feature types, grouped by task type, is stored in mlr_reflections$task_feature_types.

properties

(character())
Stores a set of properties/capabilities the surrogate has. A complete list of candidate properties, grouped by task type, is stored in mlr_reflections$learner_properties.

predict_type

(character(1))
Retrieves the currently active predict type, e.g. "response".

Methods


Method new()

Creates a new instance of this R6 class.

Usage

Surrogate$new(learner, archive, cols_x, cols_y, param_set)

Arguments

learner

(learner)
Arbitrary learner object depending on the subclass.

archive

(bbotk::Archive | NULL)
bbotk::Archive of the bbotk::OptimInstance.

cols_x

(character() | NULL)
Column id's of variables that should be used as features. By default, automatically inferred based on the archive.

cols_y

(character() | NULL)
Column id's of variables that should be used as targets. By default, automatically inferred based on the archive.

param_set

(paradox::ParamSet)
Parameter space description depending on the subclass.


Method update()

Train learner with new data. Subclasses must implement $private.update().

Usage

Surrogate$update()

Returns

NULL.


Method predict()

Predict mean response and standard error. Must be implemented by subclasses.

Usage

Surrogate$predict(xdt)

Arguments

xdt

(data.table::data.table())
New data. One row per observation.

Returns

Arbitrary prediction object.


Method format()

Helper for print outputs.

Usage

Surrogate$format()


Method print()

Print method.

Usage

Surrogate$print()

Returns

(character()).


Method clone()

The objects of this class are cloneable with this method.

Usage

Surrogate$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.