metric_types_helper {mlexperiments} | R Documentation |
metric_types_helper
Description
Prepares the data to be conform with the requirements of
the metrics from mlr3measures
.
Usage
metric_types_helper(FUN, y, perf_args)
Arguments
FUN |
A metric function, created with |
y |
The outcome vector. |
perf_args |
A list. The arguments to call the metric function with. |
Details
The mlr3measures
R package makes some restrictions on the data type of
the ground truth and the predictions, depending on the metric, i.e. the
type of the task (regression or classification).
Thus, it is necessary to convert the inputs to the metric function
accordingly, which is done with this helper function.
Value
Returns the calculated performance measure.
Examples
set.seed(123)
ground_truth <- sample(0:1, 100, replace = TRUE)
predictions <- sample(0:1, 100, replace = TRUE)
FUN <- metric("acc")
perf_args <- list(
ground_truth = ground_truth,
predictions = predictions
)
metric_types_helper(
FUN = FUN,
y = ground_truth,
perf_args = perf_args
)
[Package mlexperiments version 0.0.4 Index]