Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Plan reproducible ML experiment runs with parameters and metrics tracking
.claude/skills/brycewang-stanford-ml-experiment-tracker/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-11 | ✗→✓ | ▲ Improved | 60% | 0% |
| case-12 | ✗→✓ | ▲ Improved | 50% | 0% |
| case-18 | ✗→✓ | ▲ Improved | 42% | 0% |
| case-19 | ✗→✓ | ▲ Improved | 187% | 0% |
| case-06 | ✓→✗ | ▼ Worse | 41% | 0% |
A skill for planning, executing, and tracking machine learning experiments with full reproducibility. Covers experiment design, hyperparameter management, metric logging, model versioning, and comparison across runs to support rigorous ML research.
Machine learning research involves running dozens or hundreds of experiments with varying architectures, hyperparameters, data splits, and preprocessing pipelines. Without systematic tracking, it becomes impossible to reproduce results, compare configurations, or identify which changes actually improved performance. This skill provides a structured methodology for experiment management that aligns with academic standards for reproducible ML research.
The approach is framework-agnostic but demonstrates integration with MLflow, Weights & Biases, and plain file-based logging. It emphasizes the practices needed for publications: complete hyperparameter documentation, statistical significance testing across runs, and artifact management for model checkpoints and evaluation outputs.
Before writing any training code, document the experiment plan:
yaml# experiment_plan.yaml experiment: name: "transformer-sentiment-analysis-v3" hypothesis: "Adding relative positional encoding improves F1 on long reviews (>512 tokens)" dataset: name: "imdb-extended" version: "2025.1" splits: {train: 0.8, val: 0.1, test: 0.1} stratify_by: "label" random_seed: 42 baselines: - name: "bert-base-uncased" checkpoint: "bert-base-uncased" - name: "roberta-base" checkpoint: "roberta-base" variables: independent: - positional_encoding: ["absolute", "relative", "rotary"] controlled: - learning_rate: 2e-5 - batch_size: 32 - max_epochs: 10 - early_stopping_patience: 3 - optimizer: "AdamW" - weight_decay: 0.01 metrics: primary: "f1_macro" secondary: ["accuracy", "precision_macro", "recall_macro", "loss"] report_at: ["best_val", "final"] compute: gpus: 1 estimated_time_per_run: "45min" total_runs: 9 # 3 encodings x 3 seeds seeds: [42, 123, 456]
pythonfrom itertools import product def generate_experiment_grid(config: dict) -> list: """ Generate all experiment configurations from a factorial design. """ param_names = list(config.keys()) param_values = list(config.values()) runs = [] for combo in product(*param_values): run_config = dict(zip(param_names, combo)) run_config['run_id'] = '_'.join(f"{k}={v}" for k, v in run_config.items()) runs.append(run_config) return runs # Example: 3 learning rates x 2 batch sizes x 3 seeds = 18 runs grid = generate_experiment_grid({ 'learning_rate': [1e-5, 2e-5, 5e-5], 'batch_size': [16, 32], 'seed': [42, 123, 456] })
pythonimport mlflow import json from datetime import datetime def start_tracked_experiment(experiment_name: str, run_config: dict): """ Initialize an MLflow experiment run with full configuration logging. """ mlflow.set_experiment(experiment_name) with mlflow.start_run(run_name=run_config.get('run_id', None)) as run: # Log all hyperparameters mlflow.log_params(run_config) # Log environment info for reproducibility mlflow.log_param("python_version", "3.11.5") mlflow.log_param("torch_version", "2.1.0") mlflow.log_param("timestamp", datetime.now().isoformat()) # Log the full config as an artifact with open("/tmp/run_config.json", "w") as f: json.dump(run_config, f, indent=2) mlflow.log_artifact("/tmp/run_config.json") return run.info.run_id def log_epoch_metrics(epoch: int, metrics: dict): """Log metrics for a training epoch.""" for name, value in metrics.items(): mlflow.log_metric(name, value, step=epoch) def log_final_results(metrics: dict, model_path: str = None): """Log final evaluation metrics and optionally the model artifact.""" for name, value in metrics.items(): mlflow.log_metric(f"final_{name}", value) if model_path: mlflow.log_artifact(model_path)
pythonfrom scipy import stats import numpy as np def compare_experiment_results(results: dict) -> dict: """ Compare experiment configurations using statistical tests. Args: results: Dict mapping config_name -> list of metric values across seeds e.g., {'relative_pe': [0.87, 0.86, 0.88], 'absolute_pe': [0.84, 0.83, 0.85]} """ config_names = list(results.keys()) comparisons = {} for i in range(len(config_names)): for j in range(i + 1, len(config_names)): name_a, name_b = config_names[i], config_names[j] values_a, values_b = results[name_a], results[name_b] # Paired t-test (same seeds) t_stat, p_value = stats.ttest_rel(values_a, values_b) # Effect size (Cohen's d) diff = np.array(values_a) - np.array(values_b) cohens_d = np.mean(diff) / np.std(diff, ddof=1) comparisons[f"{name_a}_vs_{name_b}"] = { 'mean_a': np.mean(values_a), 'mean_b': np.mean(values_b), 'mean_diff': np.mean(diff), 't_statistic': round(t_stat, 4), 'p_value': round(p_value, 4), 'significant': p_value < 0.05, 'cohens_d': round(cohens_d, 3) } return comparisons
| Configuration | F1 (mean +/- std) | Accuracy | p-value vs. baseline | |--------------|-------------------|----------|---------------------| | Baseline (absolute PE) | 0.840 +/- 0.010 | 0.852 | -- | | Relative PE | 0.870 +/- 0.008 | 0.881 | 0.003 | | Rotary PE | 0.865 +/- 0.012 | 0.876 | 0.011 |
Before submitting ML results for publication, verify:
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→fail | 24,025 | 25,555 | +6% | 1 | 1 | 0% | 4,402 | 4,906 | +11% | 0 | 0 | — |
case-02 | fail→fail | 15,066 | 18,688 | +24% | 1 | 1 | 0% | 3,094 | 6,116 | +98% | 0 | 0 | — |
case-03 | pass→pass | 23,618 | 26,607 | +13% | 1 | 1 | 0% | 4,987 | 7,755 | +56% | 0 | 0 | — |
case-04 | pass→pass | 14,919 | 17,622 | +18% | 1 | 1 | 0% | 3,013 | 5,721 | +90% | 0 | 0 | — |
case-05 | pass→pass | 14,653 | 13,192 | -10% | 1 | 1 | 0% | 2,746 | 4,500 | +64% | 0 | 0 | — |
case-06 | pass→fail | 18,169 | 15,871 | -13% | 1 | 1 | 0% | 3,583 | 5,063 | +41% | 0 | 0 | — |
case-07 | fail→fail | 17,978 | 14,953 | -17% | 1 | 1 | 0% | 3,526 | 4,694 | +33% | 0 | 0 | — |
case-08 | fail→fail | 17,377 | 17,771 | +2% | 1 | 1 | 0% | 3,301 | 5,480 | +66% | 0 | 0 | — |
case-09 | fail→fail | 28,003 | 23,092 | -18% | 1 | 1 | 0% | 5,774 | 6,755 | +17% | 0 | 0 | — |
case-10 | fail→fail | 12,698 | 11,225 | -12% | 1 | 1 | 0% | 2,008 | 4,129 | +106% | 0 | 0 | — |
case-11 | fail→pass | 16,293 | 13,601 | -17% | 1 | 1 | 0% | 2,968 | 4,760 | +60% | 0 | 0 | — |
case-12 | fail→pass | 17,488 | 14,525 | -17% | 1 | 1 | 0% | 3,390 | 5,069 | +50% | 0 | 0 | — |
case-13 | pass→pass | 19,242 | 19,796 | +3% | 1 | 1 | 0% | 3,855 | 6,217 | +61% | 0 | 0 | — |
case-14 | pass→pass | 9,319 | 5,632 | -40% | 1 | 1 | 0% | 1,749 | 3,031 | +73% | 0 | 0 | — |
case-15 | fail→fail | 15,639 | 21,470 | +37% | 1 | 1 | 0% | 2,566 | 5,777 | +125% | 0 | 0 | — |
case-16 | pass→pass | 16,829 | 21,485 | +28% | 1 | 1 | 0% | 2,694 | 5,635 | +109% | 0 | 0 | — |
case-17 | pass→pass | 19,508 | 23,071 | +18% | 1 | 1 | 0% | 2,997 | 5,653 | +89% | 0 | 0 | — |
case-18 | fail→pass | 27,757 | 8,244 | -70% | 1 | 1 | 0% | 2,512 | 3,578 | +42% | 0 | 0 | — |
case-19 | fail→pass | 28,356 | 8,752 | -69% | 1 | 1 | 0% | 1,234 | 3,536 | +187% | 0 | 0 | — |
case-20 | pass→pass | 9,370 | 5,953 | -36% | 1 | 1 | 0% | 1,772 | 3,134 | +77% | 0 | 0 | — |
case-21 | fail→fail | 10,299 | 9,194 | -11% | 1 | 1 | 0% | 1,969 | 3,880 | +97% | 0 | 0 | — |
case-22 | pass→pass | 11,337 | 2,211 | -80% | 1 | 1 | 0% | 1,903 | 2,364 | +24% | 0 | 0 | — |
case-23 | fail→fail | 21,535 | 15,313 | -29% | 1 | 1 | 0% | 3,702 | 4,718 | +27% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 23 cases were attempted, and 22 counted toward the lift figure. The other 1 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +13 percentage points is the difference between those two pass rates over the 22 comparable cases. 1 case got worse with the skill loaded, and it is included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.