/ds:tuning-hyperparametersfrom ds
Guides hyperparameter tuning strategy selection, Bayesian optimization with Optuna, search space design, and result analysis for ML experiments.
Ships in ds. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
This skill provides workflow-level guidance for hyperparameter tuning in machine learning experiments. It covers strategy selection (grid, random, Bayesian, halving), Bayesian optimization with Optuna, search space design patterns, budget estimation, and result analysis -- the decisions and patterns that sit on top of the API-level tuning tools provided by scikit-learn.
Role in the ds plugin: This skill is the hyperparameter tuning workflow reference for the plugin. It is invoked by /ds:experiment at step 3 (Methodology Design) for strategy selection and search space design, at step 6 (Code Scaffold) for Optuna boilerplate generation, and at step 7 (Results) for tuning-specific result analysis and convergence diagnostics. Boundary with scikit-learn: scikit-learn provides the API patterns for GridSearchCV, RandomizedSearchCV, and HalvingGridSearchCV (what methods exist, their parameters, return values, and code examples). This skill provides the workflow guidance (when to use each strategy, how to design effective search spaces, how to estimate budgets, and how to analyze results). For sklearn search class API patterns, use the scikit-learn skill's references/model_evaluation.md. Boundary with experiment-tracking: experiment-tracking logs final hyperparameters and results. This skill manages the search process that produces those results. Boundary with statsmodels: time-series model order selection (ARIMA p,d,q) uses information criteria (AIC/BIC), not cross-validated search. Use the statsmodels skill for order selection; use this skill only when wrapping statsmodels models in Optuna for automated search.
scikit-learnstatsmodelsscikit-learnexperiment-trackingEstimate total fits: search_space_size x cv_folds = total_fits
| Total Fits | Recommended Strategy | Tool |
|---|---|---|
| < 100 | Grid search | scikit-learn GridSearchCV |
| 100 -- 500 | Random search | scikit-learn RandomizedSearchCV |
| > 500 or expensive evaluations | Bayesian optimization | Optuna study.optimize() |
| Large grid, limited budget | Successive halving | scikit-learn HalvingGridSearchCV |
For details, see references/strategy_selection.md.
import optuna
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import cross_val_score
def objective(trial):
n_estimators = trial.suggest_int("n_estimators", 50, 300)
max_depth = trial.suggest_int("max_depth", 3, 20)
min_samples_split = trial.suggest_int("min_samples_split", 2, 20)
clf = RandomForestClassifier(
n_estimators=n_estimators,
max_depth=max_depth,
min_samples_split=min_samples_split,
random_state=42,
n_jobs=-1,
)
score = cross_val_score(clf, X_train, y_train, cv=5, scoring="accuracy")
return score.mean()
study = optuna.create_study(direction="maximize")
study.optimize(objective, n_trials=100)
print(f"Best params: {study.best_params}")
print(f"Best score: {study.best_value:.4f}")
For full Optuna patterns (pruning, multi-objective, sklearn integration), see references/optuna_guide.md.
# Common distribution patterns for Optuna
learning_rate = trial.suggest_float("learning_rate", 1e-5, 1e-1, log=True) # log-uniform
n_estimators = trial.suggest_int("n_estimators", 50, 500) # uniform integer
max_depth = trial.suggest_int("max_depth", 3, 15) # uniform integer
dropout = trial.suggest_float("dropout", 0.0, 0.5) # uniform float
kernel = trial.suggest_categorical("kernel", ["rbf", "linear", "poly"]) # categorical
For per-model cheat sheets and conditional parameters, see references/search_space_design.md.
references/search_space_design.md)references/result_analysis.md)references/optuna_guide.md)suggest_* methods with appropriate distributions (references/search_space_design.md)references/result_analysis.md)n_trials x avg_train_time x cv_folds = total_timeHalvingGridSearchCV)| Paradigm | CV Strategy | Notes |
|---|---|---|
| Supervised | StratifiedKFold (classification) or KFold (regression) | Standard tuning with all strategies |
| Unsupervised | KFold with internal metrics | Tuning optional; silhouette/Davies-Bouldin as objective; cluster count is most critical parameter |
| Temporal supervised | StratifiedKFold | Standard tuning; aeon models follow sklearn API |
| Temporal unsupervised | KFold with internal metrics | Same as unsupervised |
| Time-series forecasting | TimeSeriesSplit | MUST use temporal CV; never random k-fold; consider AIC/BIC for model order selection (statsmodels) |
| Anomaly detection | Custom (train on normal data only) | Tune window_size and threshold; few parameters; grid search usually sufficient |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Generated from the plugin's indexed repository (andikarachman/data-science-plugin) — no native marketplace selected
npx claudepluginhub p/andikarachman-ds19 skills in this plugin
/aeonAeon API patterns for time series machine learning -- classification, regression, clustering, anomaly detection, segmentation, and similarity search. Use when /ds:experiment needs time-series-specific ML algorithms (ROCKET, InceptionTime, DTW classifiers), or /ds:eda needs temporal feature extraction (Catch22, ROCKET features) or change point detection. For classical statistical forecasting (ARIMA/SARIMAX) use statsmodels; for tabular ML pipelines use scikit-learn; for visualization use matplotlib./data-preprocessingPre-model data preparation pipelines for cleaning, validation, transformation, and ETL orchestration. Use when raw data needs deduplication, schema validation, format conversion, or quality assurance before EDA or modeling./data-quality-frameworksData quality validation with Great Expectations, dbt tests, and data contracts. Use when building formal validation rules, expectation suites, or data contracts for repeatable quality gates./eda-checklistSystematic exploratory data analysis checklist covering structure, quality, distributions, relationships, and target analysis. Use when starting EDA on any dataset./experiment-trackingStandard format for logging ML experiments including hypothesis, config, results, and learnings. Use when running experiments to maintain a consistent record./exploratory-data-analysisDetect file types and perform format-specific EDA across 200+ scientific data formats. Use when /ds:eda encounters non-tabular or unfamiliar data files, or when format-specific analysis guidance is needed.Other plugins' skills for the same job