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. The
tsbox::to_wide()` function can help casting time-series to this format.
Chapter in the mlr3book: https://mlr3book.mlr-org.com/basics.html#tasks
Package mlr3data for more toy tasks.
Package mlr3oml for downloading tasks from https://www.openml.org.
Package mlr3viz for some generic visualizations.
Dictionary of Tasks: mlr_tasks
as.data.table(mlr_tasks)
for a table of available Tasks in the running session (depending on the loaded packages).
mlr3fselect and mlr3filters for feature selection and feature filtering.
Extension packages for additional task types:
Unsupervised clustering: mlr3cluster
Probabilistic supervised regression and survival analysis: https://mlr3proba.mlr-org.com/.
Other Task:
TaskRegrForecast
,
mlr_tasks_airpassengers
,
mlr_tasks_petrol
mlr3::Task
-> mlr3::TaskSupervised
-> TaskForecast
date_col
(character(1)
)
Returns the date column.
Inherited methods
mlr3::Task$add_strata()
mlr3::Task$cbind()
mlr3::Task$droplevels()
mlr3::Task$filter()
mlr3::Task$format()
mlr3::Task$formula()
mlr3::Task$head()
mlr3::Task$help()
mlr3::Task$levels()
mlr3::Task$missings()
mlr3::Task$print()
mlr3::Task$rbind()
mlr3::Task$rename()
mlr3::Task$select()
mlr3::Task$set_col_roles()
mlr3::Task$set_levels()
mlr3::Task$set_row_roles()
new()
Creates a new instance of this R6 class.
TaskForecast$new(id, backend, target, date_col = NULL)
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
.
truth()
True response for specified row_ids
. Format depends on the task type.
Defaults to all rows with role "use".
rows
integer()
Row indices.
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.
rows
integer()
Row indices.
cols
character()
Column names.
data_format
(character(1)
)
Desired data format, e.g. "data.table"
or "Matrix"
.
Depending on the DataBackend, but usually a data.table::data.table()
.