setup-automl-pipeline
Configure automated ML pipelines using Optuna or Ray Tune for hyperparameter optimization. Implement efficient search strategies (Hyperband, ASHA), define search spaces, and set up early stopping to find optimal model configurations with minimal manual tuning. Use when starting a new ML project, retraining with new data and re-optimizing hyperparameters, comparing multiple algorithms, or when the team lacks deep expertise in specific algorithm hyperparameters.
Best use case
setup-automl-pipeline is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Configure automated ML pipelines using Optuna or Ray Tune for hyperparameter optimization. Implement efficient search strategies (Hyperband, ASHA), define search spaces, and set up early stopping to find optimal model configurations with minimal manual tuning. Use when starting a new ML project, retraining with new data and re-optimizing hyperparameters, comparing multiple algorithms, or when the team lacks deep expertise in specific algorithm hyperparameters.
Teams using setup-automl-pipeline should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/setup-automl-pipeline/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How setup-automl-pipeline Compares
| Feature / Agent | setup-automl-pipeline | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Configure automated ML pipelines using Optuna or Ray Tune for hyperparameter optimization. Implement efficient search strategies (Hyperband, ASHA), define search spaces, and set up early stopping to find optimal model configurations with minimal manual tuning. Use when starting a new ML project, retraining with new data and re-optimizing hyperparameters, comparing multiple algorithms, or when the team lacks deep expertise in specific algorithm hyperparameters.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Setup AutoML Pipeline
> See [Extended Examples](references/EXAMPLES.md) for complete configuration files and templates.
Automate hyperparameter tuning and model selection using Optuna or Ray Tune with efficient search strategies.
## When to Use
- Starting a new ML project and needing good model configurations quickly
- Retraining an existing model with new data and re-optimizing hyperparameters
- Comparing multiple algorithms and their optimal configurations
- Limited time for manual tuning but need near-optimal performance
- Team lacks deep expertise in specific algorithm hyperparameters
- Need a reproducible and documented optimization process
## Inputs
- **Required**: Training dataset with features and labels
- **Required**: Validation dataset for objective evaluation
- **Required**: Model type(s) to optimize (e.g., XGBoost, LightGBM, neural network)
- **Required**: Optimization objective (metric to maximize/minimize)
- **Required**: Compute budget (time or number of trials)
- **Optional**: Search space constraints (min/max values for hyperparameters)
- **Optional**: Prior knowledge of good hyperparameter ranges
## Procedure
### Step 1: Install Dependencies and Set Up Environment
Install Optuna or Ray Tune with appropriate backends.
```bash
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Option 1: Optuna (simpler, good for single-machine)
pip install optuna optuna-dashboard
pip install scikit-learn xgboost lightgbm
# Option 2: Ray Tune (distributed, good for multi-machine/GPU)
pip install "ray[tune]" optuna hyperopt bayesian-optimization
pip install torch torchvision # if optimizing neural networks
# Visualization and tracking
pip install mlflow tensorboard plotly
```
Create project structure:
```bash
mkdir -p automl/{configs,experiments,models,results}
```
**Got:** Clean environment with required packages installed, no dependency conflicts.
**If fail:** Use Python 3.8-3.11 (compatibility issues with 3.12+); on CUDA errors install CPU-only versions first; on M1/M2 Mac use conda instead of pip for scikit-learn.
### Step 2: Define Search Space and Objective (Optuna)
Create configuration for hyperparameter search.
```python
# automl/optuna_config.py
import optuna
from optuna.pruners import HyperbandPruner
from optuna.samplers import TPESampler
import xgboost as xgb
from sklearn.metrics import roc_auc_score, mean_squared_error
import numpy as np
# ... (see EXAMPLES.md for complete implementation)
```
**Got:** Search space covers reasonable hyperparameter ranges, objective function runs without errors, pruning stops unpromising trials early.
**If fail:** With trials crashing, reduce search space (e.g., lower max n_estimators), verify data has no NaN/inf values, check memory usage (reduce batch size if OOM), ensure eval_metric matches task type.
### Step 3: Run Optimization with Advanced Samplers
Execute hyperparameter search with efficient sampling strategies.
```python
# automl/run_optimization.py
import optuna
from optuna.samplers import TPESampler, CmaEsSampler, NSGAIISampler
from optuna.pruners import HyperbandPruner, MedianPruner, SuccessiveHalvingPruner
import joblib
import pandas as pd
from pathlib import Path
# ... (see EXAMPLES.md for complete implementation)
```
**Got:** Optimization completes with 50-70% of trials pruned early, best parameters found, visualization plots show convergence.
**If fail:** With no pruning happening, verify objective reports intermediate values correctly; if optimization does not improve, try a different sampler (TPE → CmaES); if it crashes with n_jobs>1, use n_jobs=1 for debugging.
### Step 4: Set Up Ray Tune for Distributed Optimization (Alternative)
Use Ray Tune for multi-GPU or multi-node optimization.
```python
# automl/ray_tune_config.py
from ray import tune
from ray.tune.schedulers import ASHAScheduler, PopulationBasedTraining
from ray.tune.search.optuna import OptunaSearch
from ray.tune.search import ConcurrencyLimiter
import xgboost as xgb
from sklearn.metrics import roc_auc_score
import os
# ... (see EXAMPLES.md for complete implementation)
```
**Got:** Ray Tune runs trials in parallel across CPUs/GPUs, ASHA scheduler stops bad trials early, best configuration found and logged.
**If fail:** With Ray crashes, start with `ray.init(num_cpus=2, num_gpus=0)` for debugging, reduce concurrent trials if OOM, check that train function does not modify shared data, use `tune.report()` not `return` for metrics.
### Step 5: Track Experiments with MLflow
Integrate with MLflow for experiment tracking and model registry.
```python
# automl/mlflow_tracking.py
import mlflow
import mlflow.xgboost
from mlflow.tracking import MlflowClient
import optuna
from pathlib import Path
# ... (see EXAMPLES.md for complete implementation)
```
**Got:** All trials logged to MLflow with parameters and metrics, best model registered in MLflow registry, experiments viewable in MLflow UI.
**If fail:** Start MLflow UI with `mlflow ui --backend-store-uri file:./automl/mlruns`, check write permissions to mlruns directory, if registration fails verify model registry is configured, ensure model artifact size < 2GB.
### Step 6: Deploy Best Model and Monitor Performance
Save optimized model and set up monitoring.
```python
# automl/deploy_model.py
import joblib
import json
from pathlib import Path
import optuna
import xgboost as xgb
# ... (see EXAMPLES.md for complete implementation)
```
**Got:** Model saved in production-ready format, configuration documented, inference script created for deployment.
**If fail:** With model file too large (>100MB), consider model compression or feature selection, verify model loads correctly in fresh Python session, test inference script with sample data before deployment.
## Validation
- [ ] Optuna/Ray Tune installs without dependency conflicts
- [ ] Search space includes reasonable hyperparameter ranges
- [ ] Objective function runs successfully for single trial
- [ ] Optimization completes 50+ trials within time budget
- [ ] Pruning stops 40-70% of unpromising trials early
- [ ] Best parameters improve over default configuration by >5%
- [ ] Visualizations show convergence (optimization history flattens)
- [ ] MLflow logs all trials with parameters and metrics
- [ ] Final model saved and loads correctly
- [ ] Deployment package includes all necessary files
## Pitfalls
- **Overfitting to validation set**: Running 1000s of trials implicitly optimizes for validation set; use holdout test set or time-based split for final evaluation
- **Ignoring feature engineering**: AutoML finds best hyperparameters but does not create features; invest in feature engineering first
- **Search space too wide**: Unbounded or very wide ranges waste trials on unrealistic values; use domain knowledge to constrain
- **Not using early stopping**: Training full epochs for every trial is wasteful; enable early stopping in objective function
- **Ignoring compute costs**: 100 trials × 10 minutes = 16 hours; consider compute budget when setting n_trials
- **Categorical features not encoded**: Most algorithms need numeric features; encode categoricals before optimization
- **Imbalanced data**: Default metrics may mislead with class imbalance; use F1, AUC, or custom metrics
- **Not saving intermediate results**: Crashes lose all progress; use persistent storage (Optuna SQLite, MLflow) to resume
## Related Skills
- `track-ml-experiments` - MLflow experiment tracking and versioning
- `orchestrate-ml-pipeline` - Airflow/Kubeflow for production AutoML pipelinesRelated Skills
setup-wsl-dev-environment
Set up a WSL2 development environment on Windows including shell configuration, essential tools, Git, SSH keys, Node.js, Python, and cross-platform path management. Use when setting up a new Windows machine for development, configuring WSL2 for the first time, adding development tools to an existing WSL installation, or setting up cross-platform workflows that combine WSL and Windows tools.
setup-uptime-checks
Configure external uptime monitoring using Blackbox Exporter and Prometheus. Implement SSL certificate monitoring, HTTP endpoint health checks, and status pages for customer-facing visibility. Use when monitoring customer-facing endpoints such as APIs and websites, tracking SSL certificate expiration, validating service availability from multiple regions, creating public status pages, or meeting SLA requirements for uptime reporting.
setup-tailwind-typescript
Configure Tailwind CSS with TypeScript in a Next.js or React project. Covers installation, configuration, custom theme extensions, component patterns, and type-safe styling utilities. Use to add Tailwind CSS to an existing TypeScript project, customize the Tailwind theme for a project's design system, set up type-safe component styling patterns, or configure Tailwind plugins and extensions.
setup-service-mesh
Deploy and configure a service mesh (Istio or Linkerd) to enable secure service-to-service communication, traffic management, observability, and policy enforcement in Kubernetes clusters. Covers installation, mTLS, traffic routing, circuit breaking, and integration with monitoring tools. Use when microservices need encrypted service-to-service communication, fine-grained traffic control for canary or A/B deployments, observability across all service interactions without application changes, or consistent circuit breaking and retry policies.
setup-putior-ci
Set up GitHub Actions CI/CD to automatically regenerate putior workflow diagrams on push. Covers workflow YAML creation, R script for diagram generation with sentinel markers, auto-commit of updated diagrams, and README sentinel integration for in-place diagram updates. Use when workflow diagrams should always reflect the current state of the code, when multiple contributors may change workflow-affecting code, or when replacing manual diagram regeneration with an automated CI/CD pipeline.
setup-prometheus-monitoring
Configure Prometheus for time-series metrics collection, including scrape configurations, service discovery, recording rules, and federation patterns for multi-cluster deployments. Use when setting up centralized metrics collection for microservices, implementing time-series monitoring for application and infrastructure, establishing a foundation for SLO/SLI tracking and alerting, or migrating from legacy monitoring solutions to a modern observability stack.
setup-local-kubernetes
Set up a local Kubernetes development environment using kind, k3d, or minikube for fast inner-loop development. Covers cluster creation, ingress configuration, local registry setup, and integration with development tools like Skaffold and Tilt for automatic rebuild and redeploy workflows. Use when needing a local Kubernetes environment for development, testing manifests or Helm charts before production deployment, wanting fast automatic rebuild-and-redeploy cycles, or learning Kubernetes without cloud costs.
setup-gxp-r-project
Set up an R project structure compliant with GxP regulations (21 CFR Part 11, EU Annex 11). Covers validated environments, qualification documentation, change control, and electronic records requirements. Use when starting an R analysis project in a regulated environment (pharma, biotech, medical devices), setting up R for clinical trial analysis, creating a validated computing environment for regulatory submissions, or implementing 21 CFR Part 11 or EU Annex 11 requirements.
setup-github-actions-ci
Configure GitHub Actions CI/CD for R packages including R CMD check on multiple platforms, test coverage reporting, and pkgdown site deployment. Uses r-lib/actions for standard workflows. Use when setting up CI/CD for a new R package, adding multi-platform testing to an existing package, configuring automated pkgdown site deployment, or adding code coverage reporting to a repository.
setup-docker-compose
Configure Docker Compose for multi-container R development environments. Covers service definitions, volume mounts, networking, environment variables, and dev vs production configurations. Use to run R alongside other services (databases, APIs), set up a reproducible R dev environment, orchestrate an R-based MCP server container, or manage environment variables and volume mounts for R projects.
setup-container-registry
Configure container image registries including GitHub Container Registry (ghcr.io), Docker Hub, and Harbor with automated image scanning, tagging strategies, retention policies, and CI/CD integration for secure image distribution. Use when setting up a private container registry, migrating from Docker Hub to self-hosted registries, implementing vulnerability scanning in CI/CD pipelines, managing multi-architecture images, enforcing image signing, or configuring automatic cleanup and retention policies.
setup-compose-stack
Configure general-purpose Docker Compose stacks for common application patterns. Covers web app + database + cache + worker services, named volumes, networks, health checks, depends_on, environment management, and profiles. Use to run a web app with a database or cache, set up a dev environment with multiple services, orchestrate background workers alongside an API, or create reproducible multi-service environments.