Forecast Task
TaskFcst.Rd
This task specializes Task, TaskSupervised and TaskRegr for forecasting problems.
The target column is assumed to be numeric.
The task_type
is set to "fcst"
.
It is recommended to use as_task_fcst()
for construction.
Predefined tasks are stored in the dictionary mlr_tasks.
See also
Chapter in the mlr3book: https://mlr3book.mlr-org.com/chapters/chapter2/data_and_basic_modeling.html
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:
mlr_tasks_airpassengers
,
mlr_tasks_electricity
,
mlr_tasks_livestock
Super classes
mlr3::Task
-> mlr3::TaskSupervised
-> mlr3::TaskRegr
-> TaskFcst
Active bindings
properties
(
character()
)
Set of task properties. Possible properties are are stored in mlr_reflections$task_properties. The following properties are currently standardized and understood by tasks in mlr3:"strata"
: The task is resampled using one or more stratification variables (role"stratum"
)."groups"
: The task comes with grouping/blocking information (role"group"
)."weights"
: The task comes with observation weights (role"weight"
)."ordered"
: The task has columns which define the row order (role"order"
)."keys"
: The task has columns which define the time series"key"
).
Note that above listed properties are calculated from the
$col_roles
and may not be set explicitly.
Methods
Inherited methods
mlr3::Task$add_strata()
mlr3::Task$cbind()
mlr3::Task$data()
mlr3::Task$divide()
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$rbind()
mlr3::Task$rename()
mlr3::Task$select()
mlr3::Task$set_col_roles()
mlr3::Task$set_levels()
mlr3::Task$set_row_roles()
mlr3::TaskRegr$truth()
Method new()
Creates a new instance of this R6 class.
The function as_task_fcst()
provides an alternative way to construct forecast tasks.
Arguments
id
(
character(1)
)
Identifier for the new instance.backend
(DataBackend)
Either a DataBackend, or any object which is convertible to a DataBackend withas_data_backend()
. E.g., adata.frame()
will be converted to a DataBackendDataTable.target
(
character(1)
)
Name of the target column.order
(
character(1)
)
Name of the order column.key
(
character(1)
)
Name of the key column.freq
(
character(1)
)
Frequency of the time series. One of"daily"
,"weekly"
,"monthly"
,"quarterly"
,"yearly"
.label
(
character(1)
)
Label for the new instance.extra_args
(named
list()
)
Named list of constructor arguments, required for converting task types viaconvert_task()
.
Examples
library(data.table)
airpassengers = tsbox::ts_dt(AirPassengers)
setnames(airpassengers, c("date", "passengers"))
task = as_task_fcst(airpassengers, target = "passengers", order = "date")
task$task_type
#> [1] "fcst"
task$formula()
#> passengers ~ .
#> NULL
task$truth()
#> [1] 112 118 132 129 121 135 148 148 136 119 104 118 115 126 141 135 125 149
#> [19] 170 170 158 133 114 140 145 150 178 163 172 178 199 199 184 162 146 166
#> [37] 171 180 193 181 183 218 230 242 209 191 172 194 196 196 236 235 229 243
#> [55] 264 272 237 211 180 201 204 188 235 227 234 264 302 293 259 229 203 229
#> [73] 242 233 267 269 270 315 364 347 312 274 237 278 284 277 317 313 318 374
#> [91] 413 405 355 306 271 306 315 301 356 348 355 422 465 467 404 347 305 336
#> [109] 340 318 362 348 363 435 491 505 404 359 310 337 360 342 406 396 420 472
#> [127] 548 559 463 407 362 405 417 391 419 461 472 535 622 606 508 461 390 432