agentleFS
topprismdatatopprismdata/cultivating-ml-agent/skills/examples/controlled-submission-experiment/SKILL.md

controlled-submission-experiment

Skill5 starsChanged 35 days agoMITView on GitHub

Use when: (1) a new submission scores worse than baseline and the reason is unclear, (2) multiple changes were made simultaneously (new model + new post-processing + new features), (3) need to isolate which component caused a regression, (4) CV improves but LB degrades, (5) comparing "smart" vs "simple" approaches, (6) verifying that model improvements are real vs artifacts of post-processing changes. CRITICAL: Never change more than one variable between submissions without controlled comparison.

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use when: (1) a new submission scores worse than baseline and the reason is unclear, (2) multiple changes were made simultaneously (new …

    line 4
  2. Distinctive:

    When multiple changes are bundled into a single submission (new features + new model + new post-processing), it's impossible to tell which …

    line 16
  3. Distinctive:

    Save raw predictions: before post-processing, so you can re-apply different post-processing

    line 91

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Controlled Submission Experiment

Problem

When multiple changes are bundled into a single submission (new features + new model + new post-processing), it's impossible to tell which change helped or hurt. A submission that scores worse than baseline might actually contain valuable model improvements hidden by a post-processing regression.

Symptoms

  • New submission scores worse than baseline despite "better" CV
  • Multiple changes made simultaneously (features + model + post-processing)
  • Zero ratio in submission changes significantly (>2%) between versions
  • Can't explain WHY the score changed in a specific direction

Solution

The Controlled Experiment Pattern

Isolate one variable at a time by creating multiple submissions from the same model output:

Baseline:  Model_A + Postproc_A  → Score_A
New:       Model_B + Postproc_B  → Score_B
Control:   Model_B + Postproc_A  → Score_C  (KEY!)

Interpretation matrix:

PatternModel BPostproc BConclusion
Score_C > Score_A, Score_B ≈ Score_CBetterNeutralModel B is better, postproc doesn't matter
Score_C > Score_A, Score_C >> Score_BBetterWorseModel B is better BUT postproc B regresses
Score_C < Score_A, Score_B ≈ Score_CWorseNeutralModel B is genuinely worse
Score_C ≈ Score_A, Score_B >> Score_ANeutralBetterPostproc B carries the improvement
Score_C > Score_A, Score_B > Score_CBetterBetterBoth improve, model B slightly more

Implementation

import pandas as pd
import numpy as np

# Step 1: Load both submission predictions (before post-processing)
r10_raw = pd.read_csv("submission_r10_raw.csv")  # baseline raw predictions
r11b_raw = pd.read_csv("submission_r11b_raw.csv")  # new raw predictions

# Step 2: Identify disputed predictions
merged = r10_raw.merge(r11b_raw, on="id", suffixes=("_r10", "_r11b"))
disputed = merged[
    (merged["sales_r11b"] == 0) & (merged["sales_r10"] > 0)
]
print(f"Disputed rows: {len(disputed)}")
print(f"R10 values in disputed: mean={disputed['sales_r10'].mean():.2f}")

# Step 3: Create controlled submission
# Use Model_B predictions but with Postproc_A logic
controlled = r11b_raw.copy()
# Apply only the baseline post-processing
controlled.loc[controlled["sales"] < 0.1, "sales"] = 0
controlled.to_csv("submission_r11c_controlled.csv", index=False)

Diagnostic: Zero Ratio Comparison

# Quick diagnostic — always check this
for name, df in [("R10", r10), ("R11b", r11b), ("R11c", r11c)]:
    zero_pct = (df["sales"] == 0).mean()
    print(f"{name}: zeros={zero_pct:.2%}, mean={df['sales'].mean():.2f}")

# If zero ratio jumps >2% between versions, investigate immediately

Prevention

  1. One variable at a time — never change model AND post-processing in the same submission
  2. Always compare zero ratios — a jump >2% signals a post-processing change that may hurt
  3. Save raw predictions before post-processing, so you can re-apply different post-processing
  4. Name your experiments (R10, R11b, R11c) to track what changed between each

Evidence (Real Experiment)

Kaggle Store Sales (Favorita), April 2026:

VersionModelPost-processingZerosLB
R10baseline< 0.1 → 08.36%0.39880
R11bimprovedmin_sales adaptive12.41%0.40073
R11cimproved< 0.1 → 08.30%0.39824

Without the controlled experiment, we would have concluded "the improved model is worse." With it, we proved the model was actually +0.00056 better, but post-processing regressed -0.00249.

Notes

  • This is the ML equivalent of A/B testing — isolate variables rigorously
  • Related to rmsle-zero-threshold-asymmetry — the specific post-processing failure mode
  • Related to kaggle-optimal-blending — when blending, also test components in isolation
  • For ensemble experiments, use the same pattern: add one model at a time, measure delta

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.