Skip to main content

A time series forecasting package based on Scikit-Learn and Polars

Project description

Yohou

Python Version License PyPI Version Conda Version codecov

What is Yohou?

Yohou is a scikit-learn-compatible time series forecasting framework built on Polars. It treats forecasting as a supervised learning reduction problem: wrap any sklearn regressor and Yohou handles windowing, tabularization, and recursive prediction while preserving temporal structure. It supports both point and interval forecasting with native panel data capabilities.

Yohou extends sklearn's API with time series-specific operations (observe, rewind, observe_predict) so fitted forecasters can ingest new data incrementally without retraining. After fitting, every forecaster exposes the same predict / predict_interval / observe_predict interface whether it wraps a simple baseline or a full decomposition pipeline.

Currently, Yohou supports Python 3.11+.

What are the features of Yohou?

  • Reduction forecasting: Wrap any scikit-learn regressor (Ridge, XGBRegressor, ...) and Yohou tabularizes, fits, and predicts recursively via PointReductionForecaster and IntervalReductionForecaster.
  • Incremental observation: Call observe() to feed new data, rewind() to roll back state, and observe_predict() to fast-forward and forecast in one step, no refitting required.
  • Composable pipelines: Chain trend, seasonality, and residual forecasters with DecompositionPipeline, or build feature pipelines with FeaturePipeline, FeatureUnion, and ColumnTransformer.
  • Preprocessing & stationarity: Lag, rolling, and EMA window transforms, signal filters, sklearn scaler wrappers, imputation, outlier handling, and stationarity transforms like SeasonalDifferencing, BoxCoxTransformer, and Fourier seasonality estimation.
  • Panel data support: Prefix columns with group__ and forecasters, transformers, and metrics operate across all groups automatically. Use ColumnForecaster or LocalPanelForecaster for per-group models.
  • Interval forecasting: Get calibrated prediction intervals via SplitConformalForecaster, IntervalReductionForecaster with DistanceSimilarity, and conformity scorers.
  • Cross-validation & tuning: Temporal splitters (ExpandingWindowSplitter, SlidingWindowSplitter) and GridSearchCV / RandomizedSearchCV designed for time series with no data leakage across time.
  • Metrics & visualization: Point and interval scorers with timewise, componentwise, and groupwise aggregation. Over 25 Plotly-based plotting functions for exploration, diagnostics, forecasting, and evaluation.
  • Bundled datasets: Seven ready-to-use Polars datasets including air_passengers, sunspots, walmart_sales, and australian_tourism for quick experimentation.
  • (Experimental) Time-weighted training: Weight recent or seasonal observations with exponential_decay_weight, linear_decay_weight, seasonal_emphasis_weight, and compose_weights, propagated via sklearn metadata routing.

How to install Yohou?

Install the Yohou package using pip:

pip install yohou

or using uv:

uv pip install yohou

or using conda:

conda install -c conda-forge yohou

or using mamba:

mamba install -c conda-forge yohou

or alternatively, add yohou to your requirements.txt or pyproject.toml file.

How to get started with Yohou?

1. Load data and split

Yohou datasets return Polars DataFrames with a "time" column.

from yohou.datasets import load_air_passengers

y = load_air_passengers()
y_train, y_test = y[:115], y[115:]

2. Fit a forecaster

Wrap an sklearn regressor in a PointReductionForecaster with a feature pipeline.

from sklearn.linear_model import Ridge

from yohou.compose import FeaturePipeline
from yohou.point import PointReductionForecaster
from yohou.preprocessing import LagTransformer

forecaster = PointReductionForecaster(
    estimator=Ridge(),
    y_transformers=FeaturePipeline(steps=[("lags", LagTransformer(lags=[1, 12]))]),
    observation_horizon=12,
)
forecaster.fit(y_train, X=None, forecasting_horizon=len(y_test))

3. Predict and evaluate

After fitting, call predict and score against the held-out data.

from yohou.metrics import MeanAbsoluteError
from yohou.plotting import plot_forecast

y_pred = forecaster.predict(forecasting_horizon=len(y_test))
MeanAbsoluteError().score(y_test, y_pred)
plot_forecast(y_test, y_pred, y_train=y_train)

How do I use Yohou?

Full documentation is available at https://yohou.readthedocs.io/.

Interactive examples are available in the examples/ directory:

Can I contribute?

We welcome contributions, feedback, and questions:

If you are interested in becoming a maintainer or taking a more active role, please reach out to Guillaume Tauzin on GitHub Discussions.

Where can I learn more?

Here are the main Yohou resources:

For questions and discussions, you can also open a discussion.

License

This project is licensed under the terms of the Apache-2.0 License.

Made by stateful-y

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

yohou-0.1.0a1.tar.gz (2.5 MB view details)

Uploaded Source

Built Distribution

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

yohou-0.1.0a1-py3-none-any.whl (2.1 MB view details)

Uploaded Python 3

File details

Details for the file yohou-0.1.0a1.tar.gz.

File metadata

  • Download URL: yohou-0.1.0a1.tar.gz
  • Upload date:
  • Size: 2.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for yohou-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 bf70f7e857ee5bb17969dcb5df069dde5e396d8e5ffd9f613f9a69159b9d39e7
MD5 36d033dd4f50e25f7948320cd9d94ddf
BLAKE2b-256 06508d9c88f130f5a1d74b7d38fcd3dbd835ac590d78566f369c2168811176f3

See more details on using hashes here.

Provenance

The following attestation bundles were made for yohou-0.1.0a1.tar.gz:

Publisher: publish-release.yml on stateful-y/yohou

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

File details

Details for the file yohou-0.1.0a1-py3-none-any.whl.

File metadata

  • Download URL: yohou-0.1.0a1-py3-none-any.whl
  • Upload date:
  • Size: 2.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for yohou-0.1.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 8ee5c19089dd748eefcdf7a44f816a99011c3c3c82571e7bab9a64164446bd86
MD5 ce0e67f85e0cedc39421ab2203522275
BLAKE2b-256 d836501d6f4de7461834a751eea9100c53cff5d6a3d6b0083b5db9a1a3be0ae5

See more details on using hashes here.

Provenance

The following attestation bundles were made for yohou-0.1.0a1-py3-none-any.whl:

Publisher: publish-release.yml on stateful-y/yohou

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