per-category-modeling-backfire

per-category-modeling-backfire is a skill for Claude Code, Codex from topprismdata/cultivating-ml-agent. It costs 103 tokens per session (1,560 once invoked), scanned A, original, MIT.

A warning that training separate machine-learning models for each category can perform worse than one global model.

In plain words
What is it for?
Use it when considering separate models for products, stores, regions, or other categories in a tabular prediction task.
Why use it?
Small or uneven groups may not contain enough data, even when their internal validation scores look better.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when considering separate models for products, stores, regions, or other categories in a tabular prediction task.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/topprismdata/cultivating-ml-agent/per-category-modeling-backfire
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add topprismdata/cultivating-ml-agent --skill per-category-modeling-backfire
Clone the repo
git clone --depth 1 https://github.com/topprismdata/cultivating-ml-agent

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for per-category-modeling-backfire

README.md
[![agentmods](https://agentmods.dev/badge/skills/topprismdata/cultivating-ml-agent/per-category-modeling-backfire/github.svg)](https://agentmods.dev/skills/topprismdata/cultivating-ml-agent/per-category-modeling-backfire)
Your own site
<a href="https://agentmods.dev/skills/topprismdata/cultivating-ml-agent/per-category-modeling-backfire"><img src="https://agentmods.dev/badge/skills/topprismdata/cultivating-ml-agent/per-category-modeling-backfire/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for per-category-modeling-backfire

Your own site · 80×15
<a href="https://agentmods.dev/skills/topprismdata/cultivating-ml-agent/per-category-modeling-backfire"><img src="https://agentmods.dev/badge/skills/topprismdata/cultivating-ml-agent/per-category-modeling-backfire.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 103 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,560 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00103 $0.01560
Opus 5 $0.00051 $0.00780
Sonnet 5 $0.00021 $0.00312
Haiku 4.5 $0.00010 $0.00156

Measured 12d ago against content hash 6a46ee7cdd6e, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

per-category-modeling-backfire scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/examples/per-category-modeling-backfire/SKILL.md · 156 lines

How it starts

The opening of the file, as written. The whole thing — 156 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Per-Category Modeling Backfire: When Splitting Data Hurts

Problem

A common "advanced" technique in Kaggle competitions is to train separate models for each category (e.g., per product family, per store, per region). While this seems intuitively correct—different categories have different patterns—it can backfire spectacularly when individual categories lack sufficient data volume.

Context / Trigger Conditions

Use when considering:

  • Training separate GBDT models per product family, store, or region
  • Per-category CV improves but leaderboard score degrades
  • Each category has <100K rows but the full dataset has >1M rows
  • Categories have highly imbalanced data volumes (some huge, some tiny)
  • The global model already handles category differences via categorical features

Specific symptoms:

  • Per-category CV: 0.367 (better) vs Global CV: 0.375 → Per-category LB: 2.10 vs Global LB: 1.86
  • Small categories show high CV variance (>0.05 std across folds)
  • Test predictions from per-category models have shifted mean (higher or lower than expected)

Solution

The Data Volume Threshold

Per-category modeling only works when each category has enough data to train a robust model.

Rows per category Per-category modeling Recommendation
<50K Harmful — overfitting, high variance Use global model
50K-200K Risky — depends on problem complexity Test both, compare LB
200K-1M Usually beneficial Per-category if CV confirms
>1M Almost always beneficial Per-category recommended

Why It Fails With Small Categories

  1. Overfitting: 70K rows × 5-fold CV = 14K validation rows. Easy to overfit.
  2. High variance: Small categories (BOOKS, HARDWARE) have CV std >0.05, meaning the model is unstable across folds.
  3. Feature instability: Lag/rolling features with limited history don't generalize.
  4. Loss of cross-category signal: Global model learns that "weekend → more sales" applies across ALL categories, amplifying this signal. Per-category models each must re-learn this from limited data.

Read the full file on GitHub · 156 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 156 lines · 103 tokens per session scan A 6a46ee7cdd6e

Subscribe to this mod's changes

per-category-modeling-backfire is a skill published in the GitHub repository topprismdata/cultivating-ml-agent (5 stars, last pushed 15d ago), licensed MIT. It adds 103 tokens to every session and 1,560 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

huggingface-hub

Hugging Face Hub CLI (hf) — search, download, and upload models and datasets, manage repos, query datasets with SQL, deploy inference endpoints, manage Spaces and buckets.

braxtonROSE4/zorro-agent · 43 tokens

tensorboard

Visualize training metrics, debug models with histograms, compare experiments, visualize model graphs, and profile performance with TensorBoard - Google's ML visualization toolkit.

davila7/claude-code-templates · 32 tokens

mlflow

Track ML experiments, manage model registry with versioning, deploy models to production, and reproduce experiments with MLflow - framework-agnostic ML lifecycle platform.

davila7/claude-code-templates · 33 tokens

datachain-knowledge

Use whenever datasets, cloud storage buckets, or data pipelines are mentioned — creating, saving, querying, listing, exploring, deleting, or processing data in S3, GCS, Azure Blob, or local storage. Also use when running any script that may create datasets as a side effect. Maintains a knowledge base at dc-knowledge/…

datachain-ai/datachain · 104 tokens

prompt-scanner

A scanner for text sent to an AI agent, looking for prompt injection and jailbreak attempts. Prompt injection is text that tries to override an agent's instructions; a jailbreak tries to bypass its safety limits.

alibaba/anolisa · 103 tokens

install-openviking-memory

Install and configure the OpenViking long-term memory plugin for OpenClaw via natural conversation. Once installed, the plugin automatically captures facts from chats and recalls relevant context before each reply (auto-capture + auto-recall, cross-session). Covers prerequisites, install through OpenClaw's plugin…

volcengine/OpenViking · 191 tokens