This task specializes Task and TaskSupervised for
spatiotemporal classification problems. The target column is assumed to be a
factor. The task_type
is set to "classif"
and "spatiotemporal"
.
A spatial example task is available via tsk("ecuador")
, a spatiotemporal
one via tsk("cookfarm")
.
The coordinate reference system passed during initialization must match the
one which was used during data creation, otherwise offsets of multiple meters
may occur. By default, coordinates are not used as features. This can be
changed by setting extra_args$coords_as_features = TRUE
.
Other Task:
TaskRegrST
,
mlr_tasks_cookfarm
,
mlr_tasks_diplodia
,
mlr_tasks_ecuador
mlr3::Task
-> mlr3::TaskSupervised
-> mlr3::TaskClassif
-> TaskClassifST
extra_args
(named list()
)
Additional task arguments set during construction.
Required for convert_task()
.
Inherited methods
new()
Create a new spatiotemporal resampling Task
TaskClassifST$new( id, backend, target, positive = NULL, extra_args = list(coords_as_features = FALSE, crs = NA, coordinate_names = NA) )
id
[character(1)]
Identifier for the task.
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.
positive
[character(1)]
Only for binary classification: Name of the positive class.
The levels of the target columns are reordered accordingly, so that the
first element of $class_names
is the positive class, and the second
element is the negative class.
extra_args
[named list]
Additional task arguments set during construction. Required for
convert_task()
.
crs [character(1)]
Coordinate reference system. Either a PROJ string or an
EPSG code.
coords_as_features [logical(1)]
Whether the coordinates should also be used as features.
coordinate_names [character(2)]
The variables names of the coordinates in the data.
coordinates()
Return the coordinates of the task
TaskClassifST$coordinates(rows = NULL)
rows
Row IDs. Can be used to subset the returned coordinates.
print()
Print the task.
TaskClassifST$print(...)
...
Arguments passed to the $print()
method of the superclass.
clone()
The objects of this class are cloneable with this method.
TaskClassifST$clone(deep = FALSE)
deep
Whether to make a deep clone.
data = mlr3::as_data_backend(ecuador) task = TaskClassifST$new("ecuador", backend = data, target = "slides", positive = "TRUE", extra_args = list(coordinate_names = c("x", "y")) ) task$task_type#> [1] "classif"task$formula()#> slides ~ . #> NULLtask$class_names#> [1] "TRUE" "FALSE"task$positive#> [1] "TRUE"task$negative#> [1] "FALSE"task$coordinates()#> x y #> 1: 712882.5 9560002 #> 2: 715232.5 9559582 #> 3: 715392.5 9560172 #> 4: 715042.5 9559312 #> 5: 715382.5 9560142 #> --- #> 747: 714472.5 9558482 #> 748: 713142.5 9560992 #> 749: 713322.5 9560562 #> 750: 715392.5 9557932 #> 751: 713802.5 9560862task$coordinate_names#> NULL