A time series forecasting package based on Scikit-Learn and Polars
Project description
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 viaPointReductionForecasterandIntervalReductionForecaster. - Incremental observation: Call
observe()to feed new data,rewind()to roll back state, andobserve_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 withFeaturePipeline,FeatureUnion, andColumnTransformer. - 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. UseColumnForecasterorLocalPanelForecasterfor per-group models. - Interval forecasting: Get calibrated prediction intervals via
SplitConformalForecaster,IntervalReductionForecasterwithDistanceSimilarity, and conformity scorers. - Time-weighted training: Weight recent or seasonal observations with
exponential_decay_weight,linear_decay_weight,seasonal_emphasis_weight, andcompose_weights, propagated via sklearn metadata routing. - Cross-validation & tuning: Temporal splitters (
ExpandingWindowSplitter,SlidingWindowSplitter) andGridSearchCV/RandomizedSearchCVdesigned for time series with no data leakage across time. - Metrics & visualization: Point and interval scorers with stepwise, vintagewise, componentwise, and groupwise aggregation. Plotly-based plotting functions for exploration, diagnostics, forecasting, and evaluation.
- Remote datasets: Eight
fetch_*functions download Monash/Zenodo time series on demand (tourism_monthly,sunspot,tourism_quarterly,electricity_demand,dominick,pedestrian_counts,hospital,kdd_cup) with local Parquet caching.
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 are fetched from Monash/Zenodo and return a Bunch with a .frame attribute (a Polars DataFrame with a "time" column).
from yohou.datasets import fetch_tourism_monthly
bunch = fetch_tourism_monthly()
y = bunch.frame.select("time", "T1__tourists").rename({"T1__tourists": "tourists"})
y_train, y_test = y[:280], y[280:]
2. Fit a forecaster
Wrap an sklearn regressor in a PointReductionForecaster with preprocessing pipelines.
from sklearn.linear_model import Ridge
from yohou.compose import FeaturePipeline
from yohou.point import PointReductionForecaster
from yohou.preprocessing import LagTransformer
from yohou.stationarity import LogTransformer, SeasonalDifferencing
forecaster = PointReductionForecaster(
estimator=Ridge(alpha=10),
target_transformer=FeaturePipeline([
("log", LogTransformer(offset=1.0)),
("diff", SeasonalDifferencing(seasonality=12)),
]),
feature_transformer=FeaturePipeline([
("lag", LagTransformer(lag=[1, 2, 3])),
]),
)
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))
scorer = MeanAbsoluteError()
scorer.fit(y_train)
scorer.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:
- Online: https://yohou.readthedocs.io/en/latest/pages/examples/
- Locally: Run
marimo edit examples/quickstart.pyto open an interactive notebook
Can I contribute?
We welcome contributions, feedback, and questions:
- Report issues or request features: GitHub Issues
- Join the discussion: GitHub Discussions
- Contributing Guide: CONTRIBUTING.md
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:
- Full documentation: https://yohou.readthedocs.io/
- GitHub Discussions: https://github.com/stateful-y/yohou/discussions
- Interactive Examples: https://yohou.readthedocs.io/en/latest/pages/examples/
For questions and discussions, you can also open a discussion.
License
This project is licensed under the terms of the Apache-2.0 License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file yohou-0.1.0a5.tar.gz.
File metadata
- Download URL: yohou-0.1.0a5.tar.gz
- Upload date:
- Size: 994.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b37695df0e680177cd5c6172be67f78b259de65313c249818ebbad6c46d1bf81
|
|
| MD5 |
b07ac302d41e0cc455fa66db6fac5cf4
|
|
| BLAKE2b-256 |
bd16bf57f615f9393a991b9e675036b959bc116e3d8cf1916296ca7a91cd04d0
|
Provenance
The following attestation bundles were made for yohou-0.1.0a5.tar.gz:
Publisher:
publish-release.yml on stateful-y/yohou
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
yohou-0.1.0a5.tar.gz -
Subject digest:
b37695df0e680177cd5c6172be67f78b259de65313c249818ebbad6c46d1bf81 - Sigstore transparency entry: 1356855622
- Sigstore integration time:
-
Permalink:
stateful-y/yohou@b1c19f2ce5bf4eefc792567356a506e79275b25c -
Branch / Tag:
refs/heads/main - Owner: https://github.com/stateful-y
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-release.yml@b1c19f2ce5bf4eefc792567356a506e79275b25c -
Trigger Event:
pull_request
-
Statement type:
File details
Details for the file yohou-0.1.0a5-py3-none-any.whl.
File metadata
- Download URL: yohou-0.1.0a5-py3-none-any.whl
- Upload date:
- Size: 476.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e68cf65e5a5026e2ca591c085afddf900f15150a298e68d210ffefe34e4a45b
|
|
| MD5 |
bbed6a2d6fcd104f222c79865624644c
|
|
| BLAKE2b-256 |
9e712f3e18679ec3c3933f6d76fa79d66078d1aa425fac451ee658c2ccc04253
|
Provenance
The following attestation bundles were made for yohou-0.1.0a5-py3-none-any.whl:
Publisher:
publish-release.yml on stateful-y/yohou
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
yohou-0.1.0a5-py3-none-any.whl -
Subject digest:
2e68cf65e5a5026e2ca591c085afddf900f15150a298e68d210ffefe34e4a45b - Sigstore transparency entry: 1356855655
- Sigstore integration time:
-
Permalink:
stateful-y/yohou@b1c19f2ce5bf4eefc792567356a506e79275b25c -
Branch / Tag:
refs/heads/main - Owner: https://github.com/stateful-y
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-release.yml@b1c19f2ce5bf4eefc792567356a506e79275b25c -
Trigger Event:
pull_request
-
Statement type: