This is the abstract base class for TaskRegrForecast. It extends TaskSupervised with methods to handle forecasting tasks.

Note, that in case the input is a data.table' or data.frame, mlr3temporalexpects a "wide" data.frame as input. Thetsbox::to_wide()` function can help casting time-series to this format.

See also

Other Task: TaskRegrForecast, mlr_tasks_airpassengers, mlr_tasks_petrol

Super classes

mlr3::Task -> mlr3::TaskSupervised -> TaskForecast

Active bindings

date_col

(character(1))
Returns the date column.

Methods

Inherited methods


Method new()

Creates a new instance of this R6 class.

Usage

TaskForecast$new(id, backend, target, date_col = NULL)

Arguments

id

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

backend

(DataBackend)
Either a DataBackend, or any object which is convertible to a DataBackend with as_data_backend(). E.g., a data.frame() will be converted to a DataBackendDataTable.

target

(character(1))
Name of the target column.

date_col

(character(1))
Name of the date column, only required if backend is a data.frame.


Method truth()

True response for specified row_ids. Format depends on the task type. Defaults to all rows with role "use".

Usage

TaskForecast$truth(rows = NULL)

Arguments

rows

integer()
Row indices.

Returns

numeric().


Method data()

Returns a slice of the data from the DataBackend in the data format specified by data_format. Rows default to observations with role "use", and columns default to features with roles "target" or "feature". If rows or cols are specified which do not exist in the DataBackend, an exception is raised.

Rows and columns are returned in the order specified via the arguments rows and cols. If rows is NULL, rows are returned in the order of task$row_ids. If cols is NULL, the column order defaults to c(task$target_names, task$feature_names). Note that it is recommended to not rely on the order of columns, and instead always address columns with their respective column name.

Usage

TaskForecast$data(rows = NULL, cols = NULL, data_format = "data.table")

Arguments

rows

integer()
Row indices.

cols

character()
Column names.

data_format

(character(1))
Desired data format, e.g. "data.table" or "Matrix".

Returns

Depending on the DataBackend, but usually a data.table::data.table().


Method date()

Returns the date column.

Usage

TaskForecast$date(rows = NULL)

Arguments

rows

integer()
Row indices.


Method clone()

The objects of this class are cloneable with this method.

Usage

TaskForecast$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.