Skip to main content

fev: Forecast evaluation library

Project description

fev

Utilities for evaluating time series forecasting models.

fev adds a thin wrapper on top of the Hugging Face (HF) datasets library, resulting in a lightweight but fully functional benchmarking solution.

Specifically, this package makes it easy to

  • define forecasting tasks
  • load time series data and generate train-test splits
  • evaluate model predictions

fev supports point & probabilistic forecasting, different types of covariates, as well as all popular forecasting metrics.

Installation

Clone the repository and install with pip

pip install -e .

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,
#  'fev_version': '0.1.0',
#  'MASE': 3.3784518}

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

Tutorials

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

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.0.1a1.tar.gz (22.7 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.0.1a1-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file fev-0.0.1a1.tar.gz.

File metadata

  • Download URL: fev-0.0.1a1.tar.gz
  • Upload date:
  • Size: 22.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for fev-0.0.1a1.tar.gz
Algorithm Hash digest
SHA256 f2cac795b52e4b8dc4727ce3f69649b908c94aeeec378b64f717bfd620f69926
MD5 aed89e8d78963cca7fae4217bb218ac7
BLAKE2b-256 7b297078aaa3c7c013da0fa489c2fd40a066bd0311ef96d51c1b4845dd076a2a

See more details on using hashes here.

Provenance

The following attestation bundles were made for fev-0.0.1a1.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.0.1a1-py3-none-any.whl.

File metadata

  • Download URL: fev-0.0.1a1-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for fev-0.0.1a1-py3-none-any.whl
Algorithm Hash digest
SHA256 4093ba31e7d11a910287b6b56a889e5d3817d11b77ddba1068a446ffb2d76ef2
MD5 4f17aec2255bc1444d79778851b8e177
BLAKE2b-256 b2dcf2300cb029e666d60d2eb6951fc4b2c63a2c361cafb302a8d771dd11d6d5

See more details on using hashes here.

Provenance

The following attestation bundles were made for fev-0.0.1a1-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