Minmax normalized ensemble blend

From wenmin-wu/ds-skills · View interactive version

Minmax normalized ensemble blend is an AI agent skill from the GitHub repository wenmin-wu/ds-skills. Min-max normalizes each model's predictions to [0,1] before averaging, ensuring equal contribution regardless of score distribution scale.

How to use this skill

Skill file

Min-Max Normalized Ensemble Blend

Overview

Different models produce predictions on different scales — one might output 0.01-0.99, another 0.3-0.7. Simple averaging lets the wider-range model dominate. Min-max normalizing each model's predictions to [0, 1] before blending ensures each contributes proportionally to the final ensemble regardless of its raw score range.

Quick Start

import pandas as pd

def minmax_normalize(series):
    return (series - series.min()) / (series.max() - series.min())

# Load predictions from different models
pred1 = pd.read_csv("submission_xlmr.csv")
pred2 = pd.read_csv("submission_bert.csv")

# Normalize then blend
submission = pred1.copy()
submission["toxic"] = (
    minmax_normalize(pred1["toxic"]) * 0.5 +
    minmax_normalize(pred2["toxic"]) * 0.5
)
submission.to_csv("submission.csv", index=False)

Workflow

  1. Generate submission files from each model independently
  2. Inspect score distributions (histogram) to confirm different scales
  3. Apply min-max normalization to each model's prediction column
  4. Blend with equal or tuned weights
  5. Optionally re-calibrate the final blend if competition metric requires it

Key Decisions

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.