compute_metrics: Compute Prediction Accuracy Metrics

View source: R/tune_imp.R

compute_metricsR Documentation

Compute Prediction Accuracy Metrics

Description

Computes 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 with data.frames that have truth and estimate columns.

metrics

A character vector of metric names to compute. Defaults to c("mae", "rmse"). Also available: "mape", "bias", "rsq", and "rsq_trad".

Details

For alternative or faster metrics, see the {yardstick} package.

Value

A data.frame with the original parameters along with unnested metrics: .metric, .estimator, and .estimate.

Examples

obj <- sim_mat(100, 100)$input

set.seed(1234)
results <- tune_imp(
  obj = obj,
  parameters = data.frame(k = 10),
  .f = "knn_imp",
  n_reps = 1,
  num_na = 20
)

compute_metrics(results)


slideimp documentation built on April 17, 2026, 1:07 a.m.