safe_compute_metrics: Compute forecast metrics, guarding against a too-short test...

View source: R/metric_utils.R

safe_compute_metricsR Documentation

Compute forecast metrics, guarding against a too-short test set

Description

Same as compute_forecast_metrics(), but checks actual_df's row count first so callers don't need their own length guard before calling it.

Usage

safe_compute_metrics(forecast_df, actual_df, label)

Arguments

forecast_df

A tibble with ds/yhat columns.

actual_df

A tibble with ds/y columns.

label

Character scalar identifying this evaluation.

Value

A tibble with columns Set, Metric, Value (see compute_forecast_metrics()).

Examples

ds <- as.Date("2024-01-01") + 0:9
forecast_df <- tibble::tibble(ds = ds, yhat = 1:10 + 0.5)
actual_df <- tibble::tibble(ds = ds, y = 1:10)
safe_compute_metrics(forecast_df, actual_df, label = "Test")

forecastsuite documentation built on Oct. 18, 2026, 5:08 p.m.