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 time series forecasting framework built on top of Scikit-Learn's ecosystem. It provides a unified interface for building, extending, and comparing any forecasting model, from sklearn-native reductions to statistical models or deep learning integrations and hyperparameter optimization workflows. All models share a consistent API with native DataFrame support, Scikit-Learn-based compositions, and first-class cross-validation.

What are the features of Yohou?

  • Polars-native: All data flows use polars.DataFrame with a mandatory "time" column. No pandas required.
  • Sklearn-compatible: Standard fit/predict API with a consistent interface across all forecaster types.
  • Reduction forecasting: Wrap any Scikit-Learn regressor (Ridge, XGBRegressor, ...) and Yohou handles windowing, tabularization, and recursive prediction via PointReductionForecaster, IntervalReductionForecaster, and ClassProbaReductionForecaster.
  • Point, interval, and class-probability forecasting: From naive baselines to conformal prediction intervals (SplitConformalForecaster) and calibrated class-probability distributions.
  • Panel data: Prefix columns with group__ and all forecasters, transformers, and metrics operate across groups automatically. Use ColumnForecaster or LocalPanelForecaster for per-group models.
  • Incremental observation: Call observe() to feed new data, rewind() to roll back state, and observe_predict() to fast-forward and forecast in one step without retraining.
  • Stateful transformers: All transformers implement fit/observe/rewind and participate fully in incremental forecasting pipelines, enabling correct state management across training and deployment.
  • Composable pipelines: Chain trend, seasonality, and residual forecasters with DecompositionPipeline, or build feature pipelines with FeaturePipeline, FeatureUnion, and ColumnTransformer.
  • Cross-validation and model selection: Temporal splitters (ExpandingWindowSplitter, SlidingWindowSplitter) and GridSearchCV/RandomizedSearchCV designed for time series with no data leakage.
  • Metrics: Point, interval, and class-probability scorers with stepwise, vintagewise, componentwise, and groupwise aggregation.

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_sunspot

bunch = fetch_sunspot()
y = bunch.frame
y_train, y_test = y[:-30], y[-30:]

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 SeasonalDifferencing

forecaster = PointReductionForecaster(
    estimator=Ridge(alpha=10),
    target_transformer=FeaturePipeline([
        ("diff", SeasonalDifferencing(seasonality=27)),
    ]),
    feature_transformer=FeaturePipeline([
        ("lag", LagTransformer(lag=[1, 2, 3, 27])),
    ]),
)
forecaster.fit(y_train, 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:

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 the maintainers at .

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.

Acknowledgements

We would like to thank Evolta Technologies for their support to the project.


Evolta Technologies


This project is maintained by stateful-y, an ML consultancy specializing in time series data science & engineering. If you're interested in collaborating or learning more about our services, please visit our website.

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.0a10.tar.gz (1.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.0a10-py3-none-any.whl (594.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for yohou-0.1.0a10.tar.gz
Algorithm Hash digest
SHA256 2482689f0764176201a9159556d3f5d500f04146931b3947c1a30a0dda9897de
MD5 8c0d51adefab7b333bce4bcac264aa10
BLAKE2b-256 be33964576a3b3287b927919857c045331ec371c3395d2179137250fbdf51a2a

See more details on using hashes here.

Provenance

The following attestation bundles were made for yohou-0.1.0a10.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.0a10-py3-none-any.whl.

File metadata

  • Download URL: yohou-0.1.0a10-py3-none-any.whl
  • Upload date:
  • Size: 594.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for yohou-0.1.0a10-py3-none-any.whl
Algorithm Hash digest
SHA256 e77ffea581fcf9ab79cf7c886765782bfb3d575c7dfdc641f210867c7723aa26
MD5 fdae9921d432eb0df9cbfe7b8db5f0ea
BLAKE2b-256 4d927fb0a67aa36001ee98128bdea09e02c7be2f120658a0cd9749caa95f63e4

See more details on using hashes here.

Provenance

The following attestation bundles were made for yohou-0.1.0a10-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