An Optuna integration for hyperparameter tuning in Yohou
Project description
What is Yohou-Optuna?
Yohou-Optuna brings Optuna's hyperparameter optimization to Yohou, providing a Yohou-compatible search class for time series forecasting.
This integration replaces grid and random search with adaptive sampling (TPE, CMA-ES, and more) while keeping Yohou's forecasting API intact. After fitting, OptunaSearchCV behaves like a Yohou forecaster, so you can call predict, observe, and observe_predict directly.
It integrates with Optuna's distributions, samplers, and storages, and wraps them for sklearn-style cloning and serialization.
What are the features of Yohou-Optuna?
- Adaptive optimization: Run Optuna studies over Yohou forecasters with TPE, CMA-ES, and other samplers to find better configurations in fewer trials.
- Forecaster-native API:
OptunaSearchCVis a forecaster after fitting, so you can callpredict,observe,observe_predict, and interval methods. - Clone-safe wrappers:
Sampler,Storage, andCallbackwrappers ensure Optuna objects survive sklearn cloning and serialization. - Time-series CV support: Works with Yohou splitters for proper temporal validation and scorer integration.
- Multi-metric evaluation: Evaluate multiple scorers and refit on the one that matters most for your use case.
- (Experimental) Persistence workflows: Resume studies with storage-backed optimization and continue tuning over time.
How to install Yohou-Optuna?
Install the Yohou-Optuna package using pip:
pip install yohou_optuna
or using uv:
uv pip install yohou_optuna
or using conda:
conda install -c conda-forge yohou_optuna
or using mamba:
mamba install -c conda-forge yohou_optuna
or alternatively, add yohou_optuna to your requirements.txt or pyproject.toml file.
How to get started with Yohou-Optuna?
1. Prepare a forecaster and search space
Define a Yohou forecaster and Optuna distributions for the parameters you want to tune.
from sklearn.linear_model import Ridge
from optuna.distributions import FloatDistribution, IntDistribution
from yohou.point import PointReductionForecaster
from yohou_optuna import OptunaSearchCV
forecaster = PointReductionForecaster(estimator=Ridge())
param_distributions = {
"estimator__alpha": FloatDistribution(1e-4, 10.0, log=True),
"observation_horizon": IntDistribution(3, 30),
}
search = OptunaSearchCV(
forecaster=forecaster,
param_distributions=param_distributions,
n_trials=30,
)
2. Fit the searcher
Fit the searcher on your time series data (polars DataFrame with a time column).
search.fit(y_train, X_train, forecasting_horizon=12)
3. Predict with the best forecaster
After fitting, search behaves like a Yohou forecaster.
y_pred = search.predict(forecasting_horizon=12)
print(search.best_params_)
How do I use Yohou-Optuna?
Full documentation is available at https://yohou-optuna.readthedocs.io/.
Interactive examples are available in the examples/ directory:
- Online: https://yohou-optuna.readthedocs.io/en/latest/pages/examples/
- Locally: Run
marimo edit examples/optuna_search.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-Optuna resources:
- Full documentation: https://yohou-optuna.readthedocs.io/
- GitHub Discussions: https://github.com/stateful-y/yohou-optuna/discussions
- Interactive Examples: https://yohou-optuna.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.
Acknowledgements
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.
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_optuna-0.1.0a3.tar.gz.
File metadata
- Download URL: yohou_optuna-0.1.0a3.tar.gz
- Upload date:
- Size: 171.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d157bb8aa06061cee64e1bd1220828bbd0ccf7bbb593730841049be1818f5e86
|
|
| MD5 |
b47757123bfde412a1d32c39040165c5
|
|
| BLAKE2b-256 |
236f468ac35a1d588d6225f85bc7d6d5f6597b12835784d9747eff268409ffce
|
Provenance
The following attestation bundles were made for yohou_optuna-0.1.0a3.tar.gz:
Publisher:
publish-release.yml on stateful-y/yohou-optuna
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
yohou_optuna-0.1.0a3.tar.gz -
Subject digest:
d157bb8aa06061cee64e1bd1220828bbd0ccf7bbb593730841049be1818f5e86 - Sigstore transparency entry: 1340666456
- Sigstore integration time:
-
Permalink:
stateful-y/yohou-optuna@5f0eb73dc048dac9ebe760f50de8ed822e0af7a8 -
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@5f0eb73dc048dac9ebe760f50de8ed822e0af7a8 -
Trigger Event:
pull_request
-
Statement type:
File details
Details for the file yohou_optuna-0.1.0a3-py3-none-any.whl.
File metadata
- Download URL: yohou_optuna-0.1.0a3-py3-none-any.whl
- Upload date:
- Size: 19.5 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 |
d2a1c342b3d6c625f3b9bee435d74cad36cb65febf4df7c32359e149a641ea60
|
|
| MD5 |
02945b826bbfb8367f6c8b2ebb707412
|
|
| BLAKE2b-256 |
33e0231d4573f3bbb8b903d159fa2b75015062a3ce96e4f1ebc4a9fcd298c6cf
|
Provenance
The following attestation bundles were made for yohou_optuna-0.1.0a3-py3-none-any.whl:
Publisher:
publish-release.yml on stateful-y/yohou-optuna
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
yohou_optuna-0.1.0a3-py3-none-any.whl -
Subject digest:
d2a1c342b3d6c625f3b9bee435d74cad36cb65febf4df7c32359e149a641ea60 - Sigstore transparency entry: 1340666459
- Sigstore integration time:
-
Permalink:
stateful-y/yohou-optuna@5f0eb73dc048dac9ebe760f50de8ed822e0af7a8 -
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@5f0eb73dc048dac9ebe760f50de8ed822e0af7a8 -
Trigger Event:
pull_request
-
Statement type: