Skip to main content

fev: Forecast evaluation library

Project description

fev

A lightweight library that makes it easy to benchmark time series forecasting models.

  • Extensible: Easy to define your own forecasting tasks and benchmarks.
  • Reproducible: Ensures that the results obtained by different users are comparable.
  • Easy to use: Compatible with most popular forecasting libraries.
  • Minimal dependencies: Just a thin wrapper on top of 🤗datasets.

How is fev different from other benchmarking tools?

Existing forecasting benchmarks usually fall into one of two categories:

  • Standalone datasets without any supporting infrastructure. These provide no guarantees that the results obtained by different users are comparable. For example, changing the start date or duration of the forecast horizon totally changes the meaning of the scores.
  • Bespoke end-to-end systems that combine models, datasets and forecasting tasks. Such packages usually come with lots of dependencies and assumptions, which makes extending or integrating these libraries into existing systems difficult.

fev aims for the middle ground - it provides the core benchmarking functionality without introducing unnecessary constraints or bloated dependencies. The library supports point & probabilistic forecasting, different types of covariates, as well as all popular forecasting metrics.

Installation

pip install fev

Quickstart

Create a task from a dataset stored on Hugging Face Hub

import fev

task = fev.Task(
    dataset_path="autogluon/chronos_datasets",
    dataset_config="monash_kdd_cup_2018",
    horizon=12,
)

Load data available as input to the forecasting model

past_data, future_data = task.get_input_data()
  • past_data contains the past data before the forecast horizon (item ID, past timestamps, target, all covariates).
  • future_data contains future data that is known at prediction time (item ID, future timestamps, and known covariates)

Make predictions

def naive_forecast(y: list, horizon: int) -> list:
    return [y[-1] for _ in range(horizon)]

predictions = []
for ts in past_data:
    predictions.append(
        {"predictions": naive_forecast(y=ts[task.target_column], horizon=task.horizon)}
    )

Get an evaluation summary

task.evaluation_summary(predictions, model_name="naive")
# {'model_name': 'naive',
#  'dataset_name': 'chronos_datasets_monash_kdd_cup_2018',
#  'dataset_fingerprint': '8a50d3417859652b',
#  'dataset_path': 'autogluon/chronos_datasets',
#  'dataset_config': 'monash_kdd_cup_2018',
#  'horizon': 12,
#  'cutoff': -12,
#  'lead_time': 1,
#  'min_ts_length': 13,
#  'max_context_length': None,
#  'seasonality': 1,
#  'eval_metric': 'MASE',
#  'extra_metrics': [],
#  'quantile_levels': None,
#  'id_column': 'id',
#  'timestamp_column': 'timestamp',
#  'target_column': 'target',
#  'multiple_target_columns': None,
#  'past_dynamic_columns': [],
#  'excluded_columns': [],
#  'test_error': 3.3784518,
#  'training_time_s': None,
#  'inference_time_s': None,
#  'trained_on_this_dataset': False,
#  'fev_version': '0.2.1',
#  'MASE': 3.3784518}

The evaluation summary contains all information necessary to uniquely identify the forecasting task.

Multiple evaluation summaries produced by different models on different tasks can be aggregated into a single table.

# Dataframes, dicts, JSON or CSV files supported
summaries = "https://raw.githubusercontent.com/autogluon/fev/refs/heads/main/benchmarks/example/results/results.csv"
fev.leaderboard(summaries)
# | model_name     |   gmean_relative_error |   avg_rank |   avg_inference_time_s |   ... |
# |:---------------|-----------------------:|-----------:|-----------------------:|------:|
# | auto_theta     |                  0.874 |      2     |                  5.501 |   ... |
# | auto_arima     |                  0.887 |      2     |                 21.799 |   ... |
# | auto_ets       |                  0.951 |      2.667 |                  0.737 |   ... |
# | seasonal_naive |                  1     |      3.333 |                  0.004 |   ... |

Tutorials

Examples of model implementations compatible with fev are available in examples/.

Leaderboards

We host leaderboards obtained using fev under https://huggingface.co/spaces/autogluon/fev-leaderboard.

Currently, the leaderboard includes the results from the Benchmark II introduced in Chronos: Learning the Language of Time Series. We expect to extend this list in the future.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fev-0.2.1.tar.gz (38.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fev-0.2.1-py3-none-any.whl (29.4 kB view details)

Uploaded Python 3

File details

Details for the file fev-0.2.1.tar.gz.

File metadata

  • Download URL: fev-0.2.1.tar.gz
  • Upload date:
  • Size: 38.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for fev-0.2.1.tar.gz
Algorithm Hash digest
SHA256 f6a01af1b191e58c7e6a1d3cb78e2e1782a9fa291d66902cc7b796a86bfad4be
MD5 132baa11046dd777af849aab8c690257
BLAKE2b-256 dc3e7f3c6fb5b05b96e5df24b9e3bbe612524fe98fb163178bf0ee411443afa4

See more details on using hashes here.

Provenance

The following attestation bundles were made for fev-0.2.1.tar.gz:

Publisher: publish-to-pypi.yml on autogluon/fev

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fev-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: fev-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 29.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for fev-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5326133dc7866e229e5d88dfab75f324ba401b7b21d2f879aea3da74e204baca
MD5 1714ac636d67de389cdc2fd35889f5c7
BLAKE2b-256 478dfd9bbb6da54509940da3e7fb4a515ba515599dca1b9bb9b1995362fac58f

See more details on using hashes here.

Provenance

The following attestation bundles were made for fev-0.2.1-py3-none-any.whl:

Publisher: publish-to-pypi.yml on autogluon/fev

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page