Optuna Flashcards

๐Ÿ”ง Optuna Flashcards

Automated Hyperparameter Optimization Framework

๐Ÿš€ What is Optuna?

Optuna is an automatic hyperparameter optimization framework designed for performance, flexibility, and ease of use.

๐Ÿ“ฆ Installation

Install via pip install optuna. Also supports LightGBM, XGBoost, PyTorch, TensorFlow, and more.

๐Ÿ” Define & Optimize

Use study.optimize() with an objective function to search for best hyperparameters automatically.

โš™๏ธ Search Spaces

Define parameter ranges with trial.suggest_float, suggest_int, suggest_categorical, etc.

๐Ÿ“Š Visualizations

Optuna provides built-in plots like optimization history, parameter importance, slice plots, and more.

๐ŸŽฏ Objective Function

The core function that returns a score (e.g., accuracy, RMSE) based on parameters sampled by Optuna.

โšก Pruning

Stop unpromising trials early using built-in pruning logic to save resources.

๐Ÿง  Samplers

Choose from various samplers like TPE (Tree-structured Parzen Estimator), CMA-ES, GridSearch, etc.

๐Ÿงช Multi-Objective Optimization

Supports optimizing for multiple objectives simultaneously, using Pareto front analysis.

๐Ÿ’พ Storage

Persist trials and studies to SQLite, PostgreSQL, or RDBs for sharing or continuation.

๐Ÿ”— Integration

Works seamlessly with Scikit-learn, LightGBM, PyTorch Lightning, Ray Tune, Keras Tuner, and others.

๐Ÿ“‚ Study Management

Create, load, or resume studies with optuna.create_study() or optuna.load_study().