compute_metrics: Compute Prediction Accuracy Metrics

View source: R/tune_imp.R

compute_metricsR Documentation

Compute Prediction Accuracy Metrics

Description

Compute prediction accuracy metrics for results from tune_imp().

Usage

compute_metrics(results, metrics = c("mae", "rmse"))

## S3 method for class 'data.frame'
compute_metrics(results, metrics = c("mae", "rmse"))

## S3 method for class 'slideimp_tune'
compute_metrics(results, metrics = c("mae", "rmse"))

Arguments

results

A slideimp_tune data frame from tune_imp(). Must contain a result list-column whose elements are data frames with truth and estimate columns.

metrics

Character vector of metric names to compute. Defaults to c("mae", "rmse"). Available metrics are "mae", "rmse", "mape", "bias", "rsq", and "rsq_trad".

Value

A data frame containing the original parameter columns along with unnested metric columns: .metric, .estimator, and .estimate.

Examples

set.seed(1234)
obj <- sim_mat(20, 30)$input

results <- tune_imp(
  obj = obj,
  parameters = data.frame(k = 5),
  .f = "knn_imp",
  n_reps = 1,
  num_na = 10,
  .progress = FALSE
)

compute_metrics(results)


slideimp documentation built on June 17, 2026, 1:08 a.m.