sklearn-pipelines

sklearn-pipelines is a skill for Claude Code, Codex from param087/agent-ml-skills. It costs 36 tokens per session (692 once invoked), scanned A, original, MIT.

A guide to scikit-learn Pipelines, which bundle data preparation and a machine-learning model into one reusable object. It also covers handling different column types and fitting preprocessing correctly during validation.

In plain words
What is it for?
Use it when encoding categories, scaling numbers, filling missing values, cross-validating models, or saving one complete preprocessing-and-model artifact.
Why use it?
It helps prevent data leakage, where information from the test data influences training, and makes the complete model easier to save and serve.

Skill for Claude CodeCodex

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

Good fit Use it when encoding categories, scaling numbers, filling missing values, cross-validating models, or saving one complete preprocessing-and-model artifact.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/param087/agent-ml-skills/sklearn-pipelines
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 param087/agent-ml-skills --skill sklearn-pipelines
Clone the repo
git clone --depth 1 https://github.com/param087/agent-ml-skills

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 sklearn-pipelines

README.md
[![agentmods](https://agentmods.dev/badge/skills/param087/agent-ml-skills/sklearn-pipelines/github.svg)](https://agentmods.dev/skills/param087/agent-ml-skills/sklearn-pipelines)
Your own site
<a href="https://agentmods.dev/skills/param087/agent-ml-skills/sklearn-pipelines"><img src="https://agentmods.dev/badge/skills/param087/agent-ml-skills/sklearn-pipelines/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 sklearn-pipelines

Your own site · 80×15
<a href="https://agentmods.dev/skills/param087/agent-ml-skills/sklearn-pipelines"><img src="https://agentmods.dev/badge/skills/param087/agent-ml-skills/sklearn-pipelines.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 36 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 692 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.00036 $0.00692
Opus 5 $0.00018 $0.00346
Sonnet 5 $0.00007 $0.00138
Haiku 4.5 $0.00004 $0.00069

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

Security

Grade A, and why

sklearn-pipelines 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 9d 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/sklearn-pipelines/SKILL.md · 86 lines

How it starts

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

scikit-learn Pipelines

Overview

A Pipeline chains preprocessing and the estimator into one object so that every fit happens on training folds only. This makes leakage structurally impossible and makes the model trivially serializable for serving. If you remember one thing from this pack: wrap preprocessing in a Pipeline.

When to use

  • Any sklearn model with preprocessing (scaling, encoding, imputing).
  • You need cross-validation that includes preprocessing.
  • You want one artifact to save and serve.

Canonical pattern

from sklearn.pipeline import Pipeline
from sklearn.compose import ColumnTransformer
from sklearn.impute import SimpleImputer
from sklearn.preprocessing import StandardScaler, OneHotEncoder
from sklearn.ensemble import HistGradientBoostingClassifier

num = ["age", "income", "tenure"]
cat = ["country", "plan"]

preprocess = ColumnTransformer([
    ("num", Pipeline([
        ("impute", SimpleImputer(strategy="median")),
        ("scale", StandardScaler()),
    ]), num),
    ("cat", Pipeline([
        ("impute", SimpleImputer(strategy="most_frequent")),
        ("ohe", OneHotEncoder(handle_unknown="ignore")),
    ]), cat),
])

model = Pipeline([
    ("prep", preprocess),
    ("clf", HistGradientBoostingClassifier(random_state=42)),
])

model.fit(X_train, y_train)        # all preprocessing fit on train only
preds = model.predict(X_test)      # preprocessing reused, no leakage

Cross-validation the right way

from sklearn.model_selection import cross_val_score, StratifiedKFold

cv = StratifiedKFold(n_splits=5, shuffle=True, random_state=42)
scores = cross_val_score(model, X, y, cv=cv, scoring="roc_auc")
# preprocessing is re-fit inside each fold automatically

Pair this with the hyperparameter-tuning skill — pass the whole pipeline to the search and tune with clf__ / prep__ prefixes.

Custom transformer

from sklearn.base import BaseEstimator, TransformerMixin

class LogTransform(BaseEstimator, TransformerMixin):
    def __init__(self, cols): self.cols = cols
    def fit(self, X, y=None): return self
    def transform(self, X):
        X = X.copy()
        X[self.cols] = np.log1p(X[self.cols])
        return X

Read the full file on GitHub · 86 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. 9d ago First seen · 86 lines · 36 tokens per session scan A 2456e45e7f39

Subscribe to this mod's changes

sklearn-pipelines is a skill published in the GitHub repository param087/agent-ml-skills (9 stars, last pushed 3mo ago), licensed MIT. It adds 36 tokens to every session and 692 once invoked, about $0.0002 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

spark-training-gotchas

Preflight and diagnose the ten known failure modes for ML training on NVIDIA DGX Spark. Use when a training run on DGX Spark fails to start, OOMs below the 128GB limit, slows down mid-run, or before any multi-hour training job on GB10.

wshobson/agents · 63 tokens

9router-embeddings

Generate vector embeddings via 9Router /v1/embeddings using OpenAI / Gemini / Mistral / Voyage / Nvidia / GitHub embedding models for RAG, semantic search, similarity. Use when the user wants embeddings, vectors, RAG, semantic search, or to embed text.

decolua/9router · 66 tokens

9router-stt

Speech-to-text via 9Router /v1/audio/transcriptions using OpenAI Whisper / Groq / Gemini / Deepgram / AssemblyAI / NVIDIA / HuggingFace models. Use when the user wants to transcribe audio, convert speech to text, or get subtitles from audio files.

decolua/9router · 63 tokens

9router

Entry point for 9Router — local/remote AI gateway with OpenAI-compatible REST for chat, image, TTS, embeddings, web search, web fetch. Use when the user mentions 9Router, NINEROUTERURL, or wants AI without writing provider boilerplate. This skill covers setup + indexes capability skills; fetch the relevant capability…

decolua/9router · 84 tokens

ultralytics-platform

This skill should be used when user asks to "upload my model to Ultralytics Platform", "push this run to the platform", "upload a dataset to platform", "download a dataset from platform", "search platform datasets", "start cloud training", "train on platform GPUs", "export a model on platform", "deploy a model…

fcakyon/claude-codex-settings · 112 tokens

dashscope

DashScope (Alibaba Cloud Bailian / 阿里云百炼) integration — image generation (qwen-image-2.0-pro), text-to-speech (qwen3-tts-flash), and ASR with word-level timestamps (qwen3-asr-flash-filetrans). Use when generating images via Qwen-Image, narrating via Qwen-TTS, or transcribing with word-level timestamps via Qwen-ASR.

calesthio/OpenMontage · 93 tokens