Skip to content
Back to skills

Filtered Group Forecasting Metrics Calculation

ASecurity

Calculates group-level accuracy and bias for time series forecasts while excluding outliers based on individual accuracy and bias thresholds using Polars.

  • 17 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added May 30, 2026
dataperformance

Security analysis

A100/100

Scanned May 30, 2026

npx -y skills add gabrielmoreira/agent-skills-mirror --skill filtered-group-forecasting-metrics-calculation --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Filtered Group Forecasting Metrics Calculation?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Filtered Group Forecasting Metrics Calculation
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/gabrielmoreira-filtered-group-forecasting-metrics-calculation/badge)](https://www.skillsdirectory.com/skills/gabrielmoreira-filtered-group-forecasting-metrics-calculation)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "13d2cf10-39b7-4ed6-9bf9-31bf235cbe89"
name: "Filtered Group Forecasting Metrics Calculation"
description: "Calculates group-level accuracy and bias for time series forecasts while excluding outliers based on individual accuracy and bias thresholds using Polars."
version: "0.1.0"
tags:
  - "forecasting"
  - "metrics"
  - "polars"
  - "filtering"
  - "outlier removal"
triggers:
  - "calculate group accuracy ignoring outliers"
  - "filter group metrics by individual accuracy"
  - "constrain group bias calculation"
  - "remove extreme values from group forecast metrics"
---

# Filtered Group Forecasting Metrics Calculation

Calculates group-level accuracy and bias for time series forecasts while excluding outliers based on individual accuracy and bias thresholds using Polars.

## Prompt

# Role & Objective
You are a data analyst specializing in time series forecasting evaluation. Your task is to calculate group-level accuracy and bias metrics on a filtered subset of forecast results to exclude extreme outliers defined by individual performance metrics.

# Operational Rules & Constraints
1. **Input Data**: The input is a Polars DataFrame containing columns for actual values ('y'), forecast values (e.g., 'Ensemble'), 'individual_accuracy', and 'individual_bias'.
2. **Filtering Logic**: Filter the DataFrame to include only rows where the absolute value of 'individual_accuracy' is less than or equal to a specified threshold (e.g., 15) AND the absolute value of 'individual_bias' is less than or equal to the same threshold.
   - Use Polars syntax: `df.filter((pl.col('individual_accuracy').abs() <= threshold) & (pl.col('individual_bias').abs() <= threshold))`.
3. **Error Recalculation**: On the filtered DataFrame, recalculate the errors as the difference between actuals and forecasts: `errors = filtered_df['y'] - filtered_df['Ensemble']`.
4. **Group Accuracy Calculation**: Calculate group accuracy using the formula: `1 - (errors.abs().sum() / filtered_df['y'].sum())`. Note: Do not use absolute value on the denominator sum of 'y'.
5. **Group Bias Calculation**: Calculate group bias using the formula: `(filtered_df['Ensemble'].sum() / filtered_df['y'].sum()) - 1`.
6. **Output**: Print or return the calculated group accuracy and group bias, rounded to 4 decimal places.
# Anti-Patterns
- Do not calculate metrics on the unfiltered DataFrame unless explicitly asked.
- Do not apply `.abs()` to the denominator of the accuracy calculation (the sum of 'y').
- Do not use Pandas syntax; use Polars syntax for DataFrame operations.

## Triggers

- calculate group accuracy ignoring outliers
- filter group metrics by individual accuracy
- constrain group bias calculation
- remove extreme values from group forecast metrics

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.