Skip to main content

Overlay_dx

PyPI version Python 3.8+ License: MIT

Visual and quantitative metric for evaluating time series forecasts

Overlay_dx is a novel evaluation metric that combines visual interpretability with quantitative assessment. It measures the alignment between predicted and actual values across different tolerance thresholds, providing both intuitive visualization and a numerical score.

Features

  • Visual interpretation through overlay curves
  • Quantitative assessment via area under curve (AUC) score
  • Less sensitive to outliers than MSE/RMSE
  • Scikit-learn compatible - works with cross_val_score, GridSearchCV, Pipeline
  • Easy to use with minimal setup

Installation

pip install overlay-dx

Quick Start

from overlay_dx import overlay_dx_score
import numpy as np

# Your predictions and actual values
y_true = np.array([1, 2, 3, 4, 5])
y_pred = np.array([1.1, 2.1, 2.9, 4.1, 5.1])

# Calculate overlay_dx score
score = overlay_dx_score(y_true, y_pred)
print(f"Overlay_dx score: {score:.3f}")
# Output: Overlay_dx score: 0.930

Scikit-learn Integration

from overlay_dx import make_overlay_dx_scorer
from sklearn.model_selection import cross_val_score
from sklearn.ensemble import RandomForestRegressor

# Create scorer
scorer = make_overlay_dx_scorer()

# Use with cross-validation
model = RandomForestRegressor()
scores = cross_val_score(model, X, y, scoring=scorer, cv=5)
print(f"CV scores: {scores.mean():.3f} (+/- {scores.std():.3f})")

With GridSearchCV

from overlay_dx import OVERLAY_DX_SCORER
from sklearn.model_selection import GridSearchCV

param_grid = {'n_estimators': [50, 100, 200]}
grid = GridSearchCV(
    RandomForestRegressor(),
    param_grid,
    scoring=OVERLAY_DX_SCORER,
    cv=5
)
grid.fit(X_train, y_train)
print(f"Best score: {grid.best_score_:.3f}")

How It Works

Overlay_dx measures the percentage of predictions falling within tolerance intervals of varying sizes around actual values. It then computes the area under the resulting curve, normalized by the maximum possible area.

Key advantages:

  • Intuitive visual interpretation
  • Robust to outliers
  • Captures performance across multiple tolerance levels
  • Easy to explain to non-technical stakeholders

Research Paper

Overlay_dx is based on peer-reviewed research published at OLA 2025:

"Overlay_dx - Automating forecasting evaluation"
Long H. Ngo, Mohammed Amine Chamli, Jonathan Rivalan, and Thomas Jaillon
4th International Conference on Optimization and Learning Algorithms (OLA 2025)

📄 Conference

The paper demonstrates overlay_dx effectiveness across multiple public datasets (Beijing Air Quality, ETT, ELD) and compares it with traditional metrics (MAE, RMSE, MAPE, etc.).

API Reference

overlay_dx_score(y_true, y_pred, max_percentage=100, min_percentage=0.1, step=0.1)

Calculate overlay_dx score.

Parameters:

  • y_true: array-like, actual values
  • y_pred: array-like, predicted values
  • max_percentage: float, maximum tolerance percentage (default: 100)
  • min_percentage: float, minimum tolerance percentage (default: 0.1)
  • step: float, step size for tolerance levels (default: 0.1)

Returns:

  • score: float between 0 and 1, higher is better

make_overlay_dx_scorer(max_percentage=100, min_percentage=0.1, step=0.1)

Create a scikit-learn scorer object.

Returns:

  • scorer: callable compatible with sklearn model selection tools

Pre-configured scorers

  • OVERLAY_DX_SCORER: Default configuration
  • OVERLAY_DX_SCORER_FINE: Fine-grained (step=0.01)
  • OVERLAY_DX_SCORER_COARSE: Coarse-grained (step=1.0)

Advanced Usage

Custom Parameters

from overlay_dx import make_overlay_dx_scorer

# Create scorer with custom tolerance range
scorer = make_overlay_dx_scorer(
    max_percentage=50,  # Only test up to 50% of range
    min_percentage=0.5,
    step=0.5
)

Using the Evaluate Class

from overlay_dx import Evaluate

evaluator = Evaluate(target_values=y_true, prediction=y_pred)

# Get various metrics
mae = evaluator.mae()
rmse = evaluator.rmse()
overlay_score = evaluator.overlay_dx_area_under_curve_metric(
    forecast=y_pred,
    max_percentage=100,
    min_percentage=0.1,
    step=0.1
)

Requirements

  • Python >= 3.8
  • numpy >= 1.20.0
  • scikit-learn >= 1.0.0
  • matplotlib >= 3.3.0

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License - see LICENSE file for details.

Citation

If you use overlay_dx in your research, please cite:

@inproceedings{ngo2025overlaydx,
  title={Overlay_dx - Automating forecasting evaluation},
  author={Ngo, Long H. and Chamli, Mohammed Amine and Rivalan, Jonathan and Jaillon, Thomas},
  booktitle={4th International Conference on Optimization and Learning Algorithms (OLA)},
  year={2025}
}

Authors

Developed by the R&D team at Smile.

Metadata

Release files for overlay-dx 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for overlay-dx 0.1.0
File Size Uploaded Provenance Actions
overlay_dx-0.1.0.tar.gz 13.3 kB Without provenance Details for overlay_dx-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for overlay-dx 0.1.0
File Interpreter ABI Platform Actions
overlay_dx-0.1.0-py3-none-any.whl Python 3 none any Details for overlay_dx-0.1.0-py3-none-any.whl

Total release size: 23.8 kB

Release files / overlay_dx-0.1.0.tar.gz

Download URL overlay_dx-0.1.0.tar.gz
Size 13.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e9b8cea768df840f71805f496f616c49906660ba2f6fbc52c4826dce70a0894e
BLAKE2b-256 checksum
How to use checksums
a3a64a3190163d5c83a54b9b6a27fc8cacffdf8d2ca5409cd685e02e0d25f75e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Release files / overlay_dx-0.1.0-py3-none-any.whl

Download URL overlay_dx-0.1.0-py3-none-any.whl
Size 10.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2178f201dc4665f96f6a1768a1a0707eb5012a3a58352a85a16c44718d6da317
BLAKE2b-256 checksum
How to use checksums
07f9eb95d86a8d988f572d0b9dc7865ab3c4276a9f475c0997b099c5c21c1215
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Security for overlay-dx 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page