TaskClassifST | R Documentation |
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_mlr3")
.
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 coords_as_features = TRUE
.
mlr3::Task
-> mlr3::TaskSupervised
-> mlr3::TaskClassif
-> TaskClassifST
crs
(character(1)
)
Returns coordinate reference system of task.
coordinate_names
(character()
)
Coordinate names.
coords_as_features
(logical(1)
)
If TRUE
, coordinates are used as features.
This is a shortcut for
task$set_col_roles(c("x", "y"), role = "feature")
with the assumption
that the coordinates in the data are named "x"
and "y"
.
mlr3::Task$add_strata()
mlr3::Task$cbind()
mlr3::Task$data()
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::TaskClassif$droplevels()
mlr3::TaskClassif$truth()
new()
Create a new spatiotemporal resampling Task
TaskClassifST$new( id, backend, target, positive = NULL, label = NA_character_, coordinate_names, crs = NA_character_, coords_as_features = FALSE, extra_args = list() )
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., am sf
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.
label
(character(1)
)
Label for the new instance. Shown in as.data.table(mlr_tasks)
.
coordinate_names
(character(1)
)
The column names of the coordinates in the data.
crs
(character(1)
)
Coordinate reference system.
WKT2 or EPSG string.
coords_as_features
(logical(1)
)
If TRUE
, coordinates are used as features.
This is a shortcut for
task$set_col_roles(c("x", "y"), role = "feature")
with the assumption
that the coordinates in the data are named "x"
and "y"
.
extra_args
(named list()
)
Named list of constructor arguments, required for converting task types
via convert_task()
.
coordinates()
Returns coordinates of observations.
TaskClassifST$coordinates(row_ids = NULL)
row_ids
(integer()
)
Vector of rows indices as subset of task$row_ids
.
data.table::data.table()
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.
Other Task:
TaskRegrST
,
mlr_tasks_cookfarm_mlr3
,
mlr_tasks_diplodia
,
mlr_tasks_ecuador
if (mlr3misc::require_namespaces(c("sf", "blockCV"), quietly = TRUE)) {
task = as_task_classif_st(ecuador,
target = "slides",
positive = "TRUE", coordinate_names = c("x", "y")
)
# passing objects of class 'sf' is also supported
data_sf = sf::st_as_sf(ecuador, coords = c("x", "y"))
task = as_task_classif_st(data_sf, target = "slides", positive = "TRUE")
task$task_type
task$formula()
task$class_names
task$positive
task$negative
task$coordinates()
task$coordinate_names
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.