View source: R/utils_metrics.R
metric_types_helper | R Documentation |
Prepares the data to be conform with the requirements of
the metrics from mlr3measures
.
metric_types_helper(FUN, y, perf_args)
FUN |
A metric function, created with |
y |
The outcome vector. |
perf_args |
A list. The arguments to call the metric function with. |
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.
Returns the calculated performance measure.
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
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.