mlr3 (version 0.1.6)

mlr_assertions: Assertion for mlr3 Objects

Description

Functions intended to be used in packages extending mlr3. Most functions assert on the respective class, and optionally additional properties. Additionally, the following compound assertions are implemented:

  • assert_learnable(task, learner) (Task, Learner) -> NULL Checks if the learner is applicable to the task. This includes type checks on the type, the feature types, and properties.

If an assertion fails, an exception is raised. Otherwise, the input object is returned invisibly.

Usage

assert_backend(b, .var.name = vname(b))

assert_task( task, task_type = NULL, feature_types = NULL, task_properties = NULL, .var.name = vname(task) )

assert_tasks( tasks, task_type = NULL, feature_types = NULL, task_properties = NULL, .var.name = vname(tasks) )

assert_learner( learner, task = NULL, properties = character(), .var.name = vname(learner) )

assert_learners( learners, task = NULL, properties = character(), .var.name = vname(learners) )

assert_learnable(task, learner)

assert_measure( measure, task = NULL, learner = NULL, .var.name = vname(measure) )

assert_measures( measures, task = NULL, learner = NULL, .var.name = vname(measures) )

assert_resampling( resampling, instantiated = NULL, .var.name = vname(resampling) )

assert_resamplings( resamplings, instantiated = NULL, .var.name = vname(resamplings) )

assert_prediction(prediction, .var.name = vname(prediction))

assert_resample_result(rr, .var.name = vname(rr))

assert_benchmark_result(bmr, .var.name = vname(bmr))

assert_row_ids(row_ids, type = NULL, .var.name = vname(row_ids))

Arguments

task

:: Task.

feature_types

:: character() Set of allowed feature types.

task_properties

:: character() Set of required task properties.

tasks

:: list of Task.

learner
learners

:: list of Learner.

measure
measures

:: list of Measure.

resampling
resamplings

:: list of Resampling.

prediction
row_ids

:: vector().

resample_result