hyperparameter-tuning

Optimize ML model hyperparameters using grid search, random search, and Bayesian optimization.

1|Updated Mar 21, 2026
One-click install
npx skills add https://github.com/kalilurrahman/kr-claudiator-skills-original-prompts --skill hyperparameter-tuning-kalilurrahman
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hyperparameter-tuning
Source: https://github.com/kalilurrahman/kr-claudiator-skills-original-prompts/tree/main/04-ai-ml/hyperparameter-tuning
Command: npx skills add https://github.com/kalilurrahman/kr-claudiator-skills-original-prompts --skill hyperparameter-tuning-kalilurrahman

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires scikit-learn, optuna, xgboost, mlflow, ray, torch, scipy, matplotlib, pandas, numpy.

What problem does it solve? Manual hyperparameter guessing wastes compute and produces suboptimal models. This Skill provides systematic tuning strategies—grid search, random search, Bayesian optimization, and Hyperband—to find the best model parameters within a defined compute budget. ## Core Features & Use Cases - Multiple Search Strategies: Grid search with scikit-learn, random search with distributions, Bayesian optimization with Optuna, and Hyperband successive halving for early stopping. - Experiment Tracking: MLflow integration logs parameters, metrics, and models for every trial, enabling reproducibility and comparison. - Deep Learning Support: Ray Tune with ASHA scheduler for distributed neural network tuning with GPU allocation. - Use Case: You have an XGBoost classifier with F1 score 0.84. Use Bayesian optimization with Optuna over 100 trials to tune learning rate, depth, and regularization, reaching F1 0.89 while pruning unpromising trials early. ## Quick Start Tune my XGBoost classifier using Bayesian optimization with Optuna over 100 trials, optimizing F1 score with 5-fold cross-validation.

Frequently Asked Questions about hyperparameter-tuning

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I tune hyperparameters with Optuna in Python?

Define an objective function that uses trial.suggest_int, suggest_float, and suggest_categorical to sample hyperparameters, then train and score the model. Create a study with optuna.create_study(direction='maximize') and call study.optimize with your trial budget.

Grid search vs random search vs Bayesian optimization: which should I use?

Use grid search for small spaces under 100 trials, random search for large spaces with limited budget since it explores more unique configurations, and Bayesian optimization for expensive evaluations like deep learning where guided sampling saves compute.

How does Optuna pruning stop bad trials early?

Optuna pruning uses integration callbacks like XGBoostPruningCallback that report intermediate validation metrics during training. Trials performing worse than historical medians are stopped early, freeing compute for more promising configurations.

Should learning rate be tuned on a log scale?

Yes, learning rates span orders of magnitude from 1e-5 to 1e-1, so use log=True in suggest_float or tune.loguniform. Linear sampling clusters values near the upper bound and misses small learning rates that often matter most.

Why use nested cross-validation for hyperparameter tuning?

Nested cross-validation tunes hyperparameters on an inner loop and evaluates on an untouched outer test fold, preventing optimistic bias. Standard tuning on a single CV split overestimates generalization performance because the test data influenced parameter selection.

How many trials are enough for hyperparameter tuning?

Around 100 trials is often sufficient for most models, and 1000 or more is rarely needed. Set early stopping patience so tuning halts when scores stop improving, and prioritize high-impact parameters like learning rate, depth, and regularization first.