skforecast/skforecast-ai/metric-selection
- community
Checking that the SKILL.md file is still in the repository.
Guides selection of the most appropriate evaluation metric(s) for a forecasting task based on forecaster type, prediction output type, data characteristics, and multi-series aggregation needs. Use when the user asks which metric to use, how to evaluate forecast quality, or needs help configuring the `metric` parameter in backtesting or hyperparameter search.
Install
npx vskill@latest install skforecast/skforecast-ai/metric-selectionSKILL.md
The same SKILL.md was published earlier as skforecast/skforecast/metric-selection.
Metric Selection
When to Use
Use this skill when the user needs help choosing an evaluation metric, comparing metrics, understanding trade-offs between error measures, or configuring the metric parameter in backtesting_forecaster, bayesian_search_forecaster, or any other model selection function.
Related skills
- Prerequisite:
choosing-a-forecaster(the forecaster type determines which metrics apply) - Alongside:
baseline-forecasting(MASE < 1 means the model beats the naive baseline) - Next:
hyperparameter-optimization(the chosen metric drives the search objective) - Next:
prediction-intervals(probabilistic metrics evaluate interval quality)
Quick Recommendations
If unsure, start here:
Point forecast metrics (pass as metric= in backtesting/search):
| Task | Default metric | Why | |
|---|---|---|---|
| General purpose | 'mean_absolute_error' | Interpretable, robust to outliers, works at any scale | |
| Compare across series | 'mean_absolute_scaled_error' | Scale-independent — the only fair comparison across differently-scaled series | |
| Classification | 'balanced_accuracy_score' | Handles class imbalance common in time series classification |
Probabilistic metrics (computed post-hoc on interval/quantile predictions):
| Task | Metric | Why | |
|---|---|---|---|
| Interval calibration | calculate_coverage | Check if actual coverage matches the nominal level | |
| Interval quality (overall) | crps_from_predictions | Evaluates sharpness and calibration together | |
| Quantile quality (foundation models) | crps_from_quantiles | Proper scoring rule for quantile predictions | |
| Single-interval quality | winkler_score | Proper interval score; tune the miscoverage penalty via alpha | |
| Full-distribution quality | weighted_interval_score | Scores K intervals + median in one number; approximates CRPS | |
| Single-quantile optimization | create_mean_pinball_loss(alpha) | Can be passed as metric= to optimize for a specific quantile |
Step 1 — What Are You Evaluating?
Step 2 — Point Forecast Metrics
Decision Table
| Criterion | Recommended metric | Avoid | |
|---|---|---|---|
| General purpose | MAE ('mean_absolute_error') | — | |
| Penalize large errors more | MSE ('mean_squared_error') | — | |
| Robust to outliers | MAE or MedAE ('median_absolute_error') | MSE (inflated by outliers) | |
| Need percentage interpretation | SMAPE ('symmetric_mean_absolute_percentage_error') | MAPE if data has zeros | |
| Data contains zeros or near-zero values | MAE, MASE, RMSSE | MAPE (divides by y_true → infinite) | |
| Compare across different-scale series | MASE ('mean_absolute_scaled_error') or RMSSE ('root_mean_squared_scaled_error') | MAE, MSE (scale-dependent) | |
| Target is always positive | MSLE ('mean_squared_log_error') | — (use when relative errors matter more than absolute) | |
| Interpretable baseline comparison | MASE (value < 1 means better than naive forecast) | — |
Metric Properties
Full property matrix (scale independence, robustness, zero handling, y_train requirement, range and interpretation) for every metric: references/metric-compatibility.md.
Using Metrics in Code
Direct computation (train/test split)
For a simple train/test evaluation, import the metric and call it directly. Sklearn metrics are imported from sklearn.metrics; skforecast-specific metrics (mean_absolute_scaled_error, root_mean_squared_scaled_error, symmetric_mean_absolute_percentage_error) from skforecast.metrics.
Inside backtesting
When using backtesting or hyperparameter search, pass metrics as strings — no import needed, and y_train is handled automatically:
MASE and RMSSE require training data to compute the naive forecast baseline. When passed as a string or callable, skforecast handles y_train automatically — it detects whether the function signature includes a y_train parameter and provides the training data if so.
Step 3 — Probabilistic Forecast Metrics
Use these metrics when evaluating prediction intervals or quantile forecasts.
| Metric | Evaluates | Input | Use case | |
|---|---|---|---|---|
calculate_coverage | Calibration | y_true, lower_bound, upper_bound | Check if actual coverage matches nominal level | |
crps_from_predictions | Calibration + sharpness | y_true (scalar), y_pred (array of bootstrap samples) | Evaluate bootstrapped interval quality | |
crps_from_quantiles | Calibration + sharpness | y_true (scalar), pred_quantiles, quantile_levels | Evaluate quantile predictions (foundation models) | |
winkler_score | Calibration + sharpness (single interval) | y_true, lower_bound, upper_bound, alpha | Evaluate one interval; penalty tuned by alpha | |
weighted_interval_score | Calibration + sharpness (full distribution) | y_true, y_pred, lower_bounds, upper_bounds, alphas | Evaluate K intervals + median in one CRPS-like score | |
create_mean_pinball_loss(alpha) | Single-quantile accuracy | y_true, y_pred (at quantile alpha) | Evaluate a specific quantile forecast |
Coverage
Coverage measures the proportion of true values that fall within the predicted interval. Target: match the nominal level (e.g., 90% interval should have ~90% coverage).
CRPS (Continuous Ranked Probability Score)
CRPS is a proper scoring rule that rewards both calibration and sharpness. Lower is better.
Winkler Score (Interval Score)
Scores a single prediction interval: it rewards narrow intervals but adds a penalty, scaled by alpha, whenever the true value falls outside. Strictly proper scoring rule; lower is better. alpha must match the interval's nominal level (e.g. an 80% interval given by the 10th/90th percentiles uses alpha=0.2).
Weighted Interval Score (WIS)
Generalises the Winkler Score to K intervals plus the median forecast, producing a single number that behaves like a discrete approximation of CRPS. Ideal when a model outputs several quantile levels (foundation models, ForecasterStats, or bootstrapping). y_pred is the median (0.5 quantile); alphas lists the K interval levels and must line up, by position, with the columns of the bound arrays. Lower is better.
Note: Likecalculate_coverageand CRPS,winkler_scoreandweighted_interval_scoreare computed post-hoc. Their signatures differ fromfunc(y_true, y_pred), so they cannot be passed as ametric=string inbacktesting or hyperparameter search.
Pinball Loss (Quantile Loss)
Evaluates a single quantile forecast. Use create_mean_pinball_loss(alpha) to create a metric function for a specific quantile level.
Step 4 — Classification Metrics
For ForecasterRecursiveClassifier only. These metrics evaluate predicted class labels, not continuous values.
| Metric | Best for | |
|---|---|---|
'accuracy_score' | Balanced classes (equal importance per class) | |
'balanced_accuracy_score' | Imbalanced classes (common in time series — e.g., rare events) | |
'f1_score' | When both precision and recall matter | |
'precision_score' | When false positives are costly | |
'recall_score' | When false negatives are costly (e.g., missing a spike) |
Step 5 — Multi-Series Metric Aggregation
When predicting multiple series, skforecast computes per-series metrics and can aggregate them into a single score. The aggregation options are:
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskforecast_ai/skills/metric-selection/SKILL.md
Popularity
- Repository stars
- 50
- Repository forks
- 6
- 7-day trend score
- 20
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/skforecast/skforecast-ai/metric-selection)