
Optuna
A Python library that automatically searches for the best settings (hyperparameters) for machine learning mode
- Stars
- 15k
- Forks
- 1.5k
- Licence
- MIT
- Language
- Python
- Last update
- 7 days ago
- Type
- Library
What it is
Optuna is a Python framework for hyperparameter optimization, meaning it automatically tries different settings for a program or machine learning model and keeps the combination that scores best. You write an objective function that suggests values and returns a score, and Optuna runs many trials to find good values. Its define-by-run API lets you build the search space dynamically in ordinary Python code.
- Search for the best model type and hyperparameters for a scikit-learn regressor, as in the sample code
- Run an optimization study with a SQLite storage file and inspect results in Optuna Dashboard
- Scale a study to multiple workers with little or no code change, per the README's key features
- Prune unpromising trials early to save compute
Great for
- Machine learning practitioners tuning model settings such as learning rate or tree depth
- Python developers who want to automate trial-and-error on any objective function
- Teams that want to run the same search across multiple workers in parallel
- Users who want a web dashboard to inspect optimization history and parameter importance
Not ideal for
- People who need a no-code tool, since the README describes a Python API that requires writing code
- Users whose objective function is very cheap and who need maximum sampling speed, where the README points to the experimental Rustuna project instead
- Non-Python codebases, since the README only shows Python usage
How to get it
- 1
Install with a package manager
You'll need: Python 3.10 or newer
Install from PyPI
pip install optunaInstall dashboard (optional)
pip install optuna-dashboard - 2
Run it
- Install Optuna with pip install optuna
- Write an objective function that calls trial.suggest_* methods and returns a score
- Create a study with optuna.create_study() and call study.optimize(objective, n_trials=100)
- Optionally, use a SQLite storage and launch optuna-dashboard sqlite:///db.sqlite3 to view results
- 3
Get the most out of it
- Use a database storage such as sqlite:///db.sqlite3 so results persist and can be viewed in the dashboard
- Use Optuna Dashboard to view optimization history and hyperparameter importance without writing extra plotting code
- Browse the optuna-examples repository for multi-objective, constrained, pruning, and distributed setups
- Try the Rustuna project if sampling speed is a bottleneck, keeping in mind it is experimental
Downloads
Strengths
- Define-by-run API lets search spaces use normal Python conditionals and loops
- Lightweight install with few requirements, per the README
- Includes a web dashboard and visualization functions for inspecting results
Trade-offs
- The README is truncated and does not fully document the feature set, so some details are unverified
- Requires Python 3.10 or newer and writing Python code to use
- Rustuna, the faster companion project, is labeled experimental and lacks some features
How it compares
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| optuna (this) | 15k | Library | intermediate | 7 days ago | Machine learning practitioners tuning model settings such as learning rate or tree depth |
| LightGBM | 18.9k | Library | intermediate | 4 days ago | Data scientists working with tabular data who want a fast gradient boosting tool |
| nni | 14.4k | Library | intermediate | 2.3 years ago | Researchers comparing hyperparameter tuning algorithms such as TPE, Hyperband, or Bayesian methods |
| wandb | 11.3k | Library | beginner | 4 days ago | Machine learning engineers who want to compare training runs over time |
| qlib | 49.9k | Library | advanced | 7 days ago | Quant researchers who want a structured ML workflow for stock data |
| albumentations | 15.3k | Library | beginner | 1.4 years ago | Machine learning engineers training image classification or segmentation models with limited data |
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.