Tasks

The mlr3 packages also ship with some data sets, readily usable as Task objects. The goal of these tasks is to quickly demonstrate the capabilities of the packages.

Example Usage

Create a classification task from the data set in the palmerpenguins package.

library("mlr3verse")

# create a task
task = tsk("breast_cancer")
task
<TaskClassif:breast_cancer> (683 x 10): Wisconsin Breast Cancer
* Target: class
* Properties: twoclass
* Features (9):
  - ord (9): bare_nuclei, bl_cromatin, cell_shape, cell_size,
    cl_thickness, epith_c_size, marg_adhesion, mitoses, normal_nucleoli
# get the dimensions
c(task$nrow, task$ncol)
[1] 683  10
# check for missing values
task$missings()
          class     bare_nuclei     bl_cromatin      cell_shape       cell_size 
              0               0               0               0               0 
   cl_thickness    epith_c_size   marg_adhesion         mitoses normal_nucleoli 
              0               0               0               0               0 
# plot class frequencies
autoplot(task)