This Learner specializes Learner for forecasting problems:

  • task_type is set to "forecast".

  • Creates Predictions of class PredictionForecast.

  • Possible values for predict_types are:

    • "response": Predicts a numeric response for each observation in the test set.

    • "se": Predicts the standard error for each value of response for each observation in the test set.

    • "distr": Probability distribution as VectorDistribution object (requires package distr6, available via repository https://raphaels1.r-universe.dev).

See also

Other Learner: mlr_learners_regr.VAR, mlr_learners_regr.arima, mlr_learners_regr.auto_arima, mlr_learners_regr.average

Super class

mlr3::Learner -> LearnerForecast

Public fields

date_span

(named list())
Stores the beginning and end of the date span of the training data.

Methods

Inherited methods


Method new()

Creates a new instance of this R6 class.

Usage

LearnerForecast$new(
  id,
  param_set = ps(),
  predict_types = "response",
  feature_types = character(),
  properties = character(),
  data_formats = "data.table",
  packages = character(),
  man = NA_character_
)

Arguments

id

(character(1))
Identifier for the new instance.

param_set

(paradox::ParamSet)
Set of hyperparameters.

predict_types

(character())
Supported predict types. Must be a subset of mlr_reflections$learner_predict_types.

feature_types

(character())
Feature types the learner operates on. Must be a subset of mlr_reflections$task_feature_types.

properties

(character())
Set of properties of the Learner. Must be a subset of mlr_reflections$learner_properties. The following properties are currently standardized and understood by learners in mlr3:

  • "missings": The learner can handle missing values in the data.

  • "weights": The learner supports observation weights.

  • "importance": The learner supports extraction of importance scores, i.e. comes with an $importance() extractor function (see section on optional extractors in Learner).

  • "selected_features": The learner supports extraction of the set of selected features, i.e. comes with a $selected_features() extractor function (see section on optional extractors in Learner).

  • "oob_error": The learner supports extraction of estimated out of bag error, i.e. comes with a oob_error() extractor function (see section on optional extractors in Learner).

data_formats

(character())
Set of supported data formats which can be processed during $train() and $predict(), e.g. "data.table".

packages

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

man

(character(1))
String in the format [pkg]::[topic] pointing to a manual page for this object. The referenced help package can be opened via method $help().


Method train()

Train the learner on a set of observations of the provided task. Mutates the learner by reference, i.e. stores the model alongside other information in field $state.

Usage

LearnerForecast$train(task, row_ids = NULL)

Arguments

task

(Task).

row_ids

(integer())
Vector of training indices as subset of task$row_ids. For a simple split into training and test set, see partition().

Returns

Returns the object itself, but modified by reference. You need to explicitly $clone() the object beforehand if you want to keeps the object in its previous state.


Method predict()

Uses the information stored during $train() in $state to create a new Prediction for a set of observations of the provided task.

Usage

LearnerForecast$predict(task, row_ids = NULL)

Arguments

task

(Task).

row_ids

(integer())
Vector of test indices as subset of task$row_ids. For a simple split into training and test set, see partition().

Returns

Prediction.


Method fitted_values()

Returns the fitted values of the model, i.e. the values that the model predicted for the training data.

Usage

LearnerForecast$fitted_values(
  row_ids = self$date_span$begin$row_id:self$date_span$end$row_id
)

Arguments

row_ids

(integer())
Vector of test indices as subset of task$row_ids. For a simple split into training and test set, see partition().


Method clone()

The objects of this class are cloneable with this method.

Usage

LearnerForecast$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.