[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7EVVF371426BJFS1K048VAH":3,"skill-same:01M7EVVF371426BJFS1K048VAH":47},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":25,"commitSha":26,"skillDirectory":27,"forksCount":28,"repositoryHtmlUrl":29,"repositoryHomepageUrl":6,"ownerHtmlUrl":30,"ownerBlogUrl":31,"ownerDescription":6,"updatedAt":32,"install":33,"resources":46},"01M7EVVF371426BJFS1K048VAH","scikit-learn-pro",null,"scikit-learn guidance — pipelines, model selection, cross-validation, preprocessing, and production deployment.","TanNhatCMS\u002Fjarvis","TanNhatCMS","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F113796420?v=4","01M753MV17KG5CD3152G3WQEQY","KietNT","01M7EKEDYVYQ6PWVJJMZ911VMX",0,"MIT","https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Fams-scikit-learn-pro\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: scikit-learn-pro\ndescription: scikit-learn guidance — pipelines, model selection, cross-validation, preprocessing, and production deployment.\ncategory: development\n---\n\n## Overview\n\nscikit-learn is the workhorse of classical machine learning: consistent `fit`\u002F`predict`\u002F`transform` APIs across dozens of estimators, excellent preprocessing and model-selection tooling, and the `Pipeline` abstraction that prevents the most common ML bug (data leakage). For tabular data and problems that don't need deep learning, it's usually the right tool.\n\nThis skill covers the sklearn workflow done properly: pipelines, correct cross-validation, preprocessing, hyperparameter search, and the path from experiment to a deployed model.\n\n## When to use\n\n- Building classical ML models (classification, regression, clustering).\n- Preventing data leakage with pipelines.\n- Tuning hyperparameters (grid\u002Frandom search).\n- Preprocessing (scaling, encoding, imputation).\n- Evaluating models correctly (cross-validation, metrics).\n- Deploying sklearn models to production.\n\n## Core concepts\n\n- **The estimator API.** `fit(X, y)`, `predict(X)`, `transform(X)`, `score(X, y)` — uniform across the library. Learn the contract once, apply everywhere. `get_params`\u002F`set_params` enable search and cloning.\n- **Pipelines.** `Pipeline([('scale', StandardScaler()), ('clf', LogisticRegression())])` — preprocessing + model as one object that cross-validates and deploys correctly. The #1 leakage prevention: transformers fit only on training folds inside CV.\n- **ColumnTransformer.** Different preprocessing per column type (scale numerics, one-hot categoricals, passthrough the rest) — the real-world pipeline that handles messy DataFrames.\n- **Train\u002Ftest split.** `train_test_split` with `stratify=y` for classification, `random_state` for reproducibility. The test set is touched once — for final evaluation, never for decisions.\n- **Cross-validation.** `cross_val_score` \u002F `cross_validate` with `StratifiedKFold` (classification), `GroupKFold` (grouped data — patients, users), `TimeSeriesSplit` (temporal data — no shuffling the future into the past). CV strategy must match the data structure.\n- **Data leakage.** Fitting preprocessors on full data before splitting; target-derived features; future information in time series. Pipelines + correct CV eliminate most leakage; constant vigilance handles the rest.\n- **Metrics.** Accuracy is rarely the right metric: precision\u002Frecall\u002FF1, ROC-AUC, PR-AUC for classification; RMSE\u002FMAE\u002FR² for regression. Choose the metric that matches the business cost of errors; optimize and report it consistently.\n- **Imbalanced data.** `class_weight='balanced'`, resampling (SMOTE etc.), threshold tuning on PR curves — accuracy lies on imbalanced data; PR-AUC and business-weighted metrics tell the truth.\n- **Hyperparameter search.** `GridSearchCV` (small spaces), `RandomizedSearchCV` (larger spaces, better value), successive halving for expensive fits. Search inside nested CV for unbiased performance estimates; search on the pipeline, not the bare estimator.\n- **Preprocessing.** `StandardScaler` (regularized linear models, SVMs, kNN), `OneHotEncoder(handle_unknown='ignore')` (categoricals — the `handle_unknown` is production-critical), `SimpleImputer` (missing values — fit on train only), text (`TfidfVectorizer`).\n- **Feature selection\u002Fengineering.** `SelectKBest`, RFECV, or model-based selection — inside the pipeline. Polynomial features for linear models; domain features beat algorithm tuning.\n- **Calibration.** `CalibratedClassifierCV` — when you need trustworthy probabilities (risk scoring, expected-value decisions), not just rankings.\n- **Model persistence.** `joblib.dump` of the whole pipeline (preprocessing included!) — deploying the estimator without its preprocessing is a classic production bug. Version the artifact with its training metadata.\n- **Inspection.** `permutation_importance`, partial dependence, coefficients for linear models — understand what the model learned before trusting it.\n- **Baselines first.** DummyClassifier\u002FDummyRegressor and a simple logistic regression — if a fancy model barely beats the baseline, the features (not the algorithm) need work.\n\n## Practical workflow\n\n1. **Start with baselines.** Dummy + logistic regression; record the metric. Every subsequent improvement is measured against this.\n2. **Build the pipeline.** Preprocessing + estimator as one object from the start — never fit transformers outside it:\n   ```python\n   from sklearn.compose import ColumnTransformer\n   from sklearn.pipeline import Pipeline\n   from sklearn.preprocessing import OneHotEncoder, StandardScaler\n   from sklearn.impute import SimpleImputer\n   from sklearn.ensemble import HistGradientBoostingClassifier\n\n   numeric = Pipeline([(\"impute\", SimpleImputer(strategy=\"median\")),\n                       (\"scale\", StandardScaler())])\n   categorical = Pipeline([(\"impute\", SimpleImputer(strategy=\"most_frequent\")),\n                           (\"onehot\", OneHotEncoder(handle_unknown=\"ignore\"))])\n   pre = ColumnTransformer([(\"num\", numeric, num_cols), (\"cat\", categorical, cat_cols)])\n   pipe = Pipeline([(\"pre\", pre), (\"clf\", HistGradientBoostingClassifier())])\n   ```\n3. **Validate correctly.** Stratified\u002Fgrouped\u002Ftime-series CV matching the data; the metric matching the business cost:\n   ```python\n   from sklearn.model_selection import cross_validate, StratifiedKFold\n   cv = StratifiedKFold(n_splits=5, shuffle=True, random_state=42)\n   scores = cross_validate(pipe, X, y, cv=cv,\n                           scoring=[\"roc_auc\", \"average_precision\"])\n   ```\n4. **Tune inside the pipeline.** `RandomizedSearchCV` on pipeline params (`clf__learning_rate`); nested CV if you need unbiased estimates of the tuned model.\n5. **Inspect.** Permutation importance, confusion matrix, calibration curve — does the model learn sensible things?\n6. **Evaluate once on held-out test.** A single final number; if you iterate on it, it's validation data now.\n7. **Persist the pipeline.** `joblib.dump(pipe, \"model-v3.joblib\")` — preprocessing included; log training data version, code commit, and metrics alongside.\n8. **Deploy with monitoring.** Batch or API serving; monitor input distributions and prediction drift; retrain on schedule or trigger.\n\n## Common pitfalls\n\n- **Leakage via preprocessing** — scaling\u002Fimputing before splitting; pipelines fit inside CV folds.\n- **Wrong CV strategy** — shuffling time series, ignoring groups; match CV to data structure.\n- **Accuracy on imbalanced data** — 99% accuracy, useless model; PR-AUC, F1, business metrics.\n- **Tuning on the test set** — test-set overfitting by repeated peeking; test touched once.\n- **Deploying estimator without preprocessing** — training pipeline ≠ serving pipeline; persist the whole Pipeline.\n- **`OneHotEncoder` without `handle_unknown='ignore'`** — new categories crashing production; always set it.\n- **No baselines** — complex model, unknown value; dummy + linear first.\n- **Unscaled features for distance models** — kNN\u002FSVM dominated by large-scale features; scale.\n- **Ignoring calibration** — uncalibrated probabilities driving decisions; calibrate when probabilities matter.\n- **Grid search over tiny spaces** — wasting compute on 3x3 grids; randomized search over wide ranges.\n- **Target leakage in features** — features derived from the target; audit feature definitions.\n- **No random_state** — unreproducible results; seed everything.\n- **Metric\u002Fdecision mismatch** — optimizing AUC while the business needs precision@k; align metric to decision.\n","## Overview\n\nscikit-learn is the workhorse of classical machine learning: consistent `fit`\u002F`predict`\u002F`transform` APIs across dozens of estimators, excellent preprocessing and model-selection tooling, and the `Pipeline` abstraction that prevents the most common ML bug (data leakage). For tabular data and problems that don't need deep learning, it's usually the right tool.\n\nThis skill covers the sklearn workflow done properly: pipelines, correct cross-validation, preprocessing, hyperparameter search, and the path from experiment to a deployed model.\n\n## When to use\n\n- Building classical ML models (classification, regression, clustering).\n- Preventing data leakage with pipelines.\n- Tuning hyperparameters (grid\u002Frandom search).\n- Preprocessing (scaling, encoding, imputation).\n- Evaluating models correctly (cross-validation, metrics).\n- Deploying sklearn models to production.\n\n## Core concepts\n\n- **The estimator API.** `fit(X, y)`, `predict(X)`, `transform(X)`, `score(X, y)` — uniform across the library. Learn the contract once, apply everywhere. `get_params`\u002F`set_params` enable search and cloning.\n- **Pipelines.** `Pipeline([('scale', StandardScaler()), ('clf', LogisticRegression())])` — preprocessing + model as one object that cross-validates and deploys correctly. The #1 leakage prevention: transformers fit only on training folds inside CV.\n- **ColumnTransformer.** Different preprocessing per column type (scale numerics, one-hot categoricals, passthrough the rest) — the real-world pipeline that handles messy DataFrames.\n- **Train\u002Ftest split.** `train_test_split` with `stratify=y` for classification, `random_state` for reproducibility. The test set is touched once — for final evaluation, never for decisions.\n- **Cross-validation.** `cross_val_score` \u002F `cross_validate` with `StratifiedKFold` (classification), `GroupKFold` (grouped data — patients, users), `TimeSeriesSplit` (temporal data — no shuffling the future into the past). CV strategy must match the data structure.\n- **Data leakage.** Fitting preprocessors on full data before splitting; target-derived features; future information in time series. Pipelines + correct CV eliminate most leakage; constant vigilance handles the rest.\n- **Metrics.** Accuracy is rarely the right metric: precision\u002Frecall\u002FF1, ROC-AUC, PR-AUC for classification; RMSE\u002FMAE\u002FR² for regression. Choose the metric that matches the business cost of errors; optimize and report it consistently.\n- **Imbalanced data.** `class_weight='balanced'`, resampling (SMOTE etc.), threshold tuning on PR curves — accuracy lies on imbalanced data; PR-AUC and business-weighted metrics tell the truth.\n- **Hyperparameter search.** `GridSearchCV` (small spaces), `RandomizedSearchCV` (larger spaces, better value), successive halving for expensive fits. Search inside nested CV for unbiased performance estimates; search on the pipeline, not the bare estimator.\n- **Preprocessing.** `StandardScaler` (regularized linear models, SVMs, kNN), `OneHotEncoder(handle_unknown='ignore')` (categoricals — the `handle_unknown` is production-critical), `SimpleImputer` (missing values — fit on train only), text (`TfidfVectorizer`).\n- **Feature selection\u002Fengineering.** `SelectKBest`, RFECV, or model-based selection — inside the pipeline. Polynomial features for linear models; domain features beat algorithm tuning.\n- **Calibration.** `CalibratedClassifierCV` — when you need trustworthy probabilities (risk scoring, expected-value decisions), not just rankings.\n- **Model persistence.** `joblib.dump` of the whole pipeline (preprocessing included!) — deploying the estimator without its preprocessing is a classic production bug. Version the artifact with its training metadata.\n- **Inspection.** `permutation_importance`, partial dependence, coefficients for linear models — understand what the model learned before trusting it.\n- **Baselines first.** DummyClassifier\u002FDummyRegressor and a simple logistic regression — if a fancy model barely beats the baseline, the features (not the algorithm) need work.\n\n## Practical workflow\n\n1. **Start with baselines.** Dummy + logistic regression; record the metric. Every subsequent improvement is measured against this.\n2. **Build the pipeline.** Preprocessing + estimator as one object from the start — never fit transformers outside it:\n   ```python\n   from sklearn.compose import ColumnTransformer\n   from sklearn.pipeline import Pipeline\n   from sklearn.preprocessing import OneHotEncoder, StandardScaler\n   from sklearn.impute import SimpleImputer\n   from sklearn.ensemble import HistGradientBoostingClassifier\n\n   numeric = Pipeline([(\"impute\", SimpleImputer(strategy=\"median\")),\n                       (\"scale\", StandardScaler())])\n   categorical = Pipeline([(\"impute\", SimpleImputer(strategy=\"most_frequent\")),\n                           (\"onehot\", OneHotEncoder(handle_unknown=\"ignore\"))])\n   pre = ColumnTransformer([(\"num\", numeric, num_cols), (\"cat\", categorical, cat_cols)])\n   pipe = Pipeline([(\"pre\", pre), (\"clf\", HistGradientBoostingClassifier())])\n   ```\n3. **Validate correctly.** Stratified\u002Fgrouped\u002Ftime-series CV matching the data; the metric matching the business cost:\n   ```python\n   from sklearn.model_selection import cross_validate, StratifiedKFold\n   cv = StratifiedKFold(n_splits=5, shuffle=True, random_state=42)\n   scores = cross_validate(pipe, X, y, cv=cv,\n                           scoring=[\"roc_auc\", \"average_precision\"])\n   ```\n4. **Tune inside the pipeline.** `RandomizedSearchCV` on pipeline params (`clf__learning_rate`); nested CV if you need unbiased estimates of the tuned model.\n5. **Inspect.** Permutation importance, confusion matrix, calibration curve — does the model learn sensible things?\n6. **Evaluate once on held-out test.** A single final number; if you iterate on it, it's validation data now.\n7. **Persist the pipeline.** `joblib.dump(pipe, \"model-v3.joblib\")` — preprocessing included; log training data version, code commit, and metrics alongside.\n8. **Deploy with monitoring.** Batch or API serving; monitor input distributions and prediction drift; retrain on schedule or trigger.\n\n## Common pitfalls\n\n- **Leakage via preprocessing** — scaling\u002Fimputing before splitting; pipelines fit inside CV folds.\n- **Wrong CV strategy** — shuffling time series, ignoring groups; match CV to data structure.\n- **Accuracy on imbalanced data** — 99% accuracy, useless model; PR-AUC, F1, business metrics.\n- **Tuning on the test set** — test-set overfitting by repeated peeking; test touched once.\n- **Deploying estimator without preprocessing** — training pipeline ≠ serving pipeline; persist the whole Pipeline.\n- **`OneHotEncoder` without `handle_unknown='ignore'`** — new categories crashing production; always set it.\n- **No baselines** — complex model, unknown value; dummy + linear first.\n- **Unscaled features for distance models** — kNN\u002FSVM dominated by large-scale features; scale.\n- **Ignoring calibration** — uncalibrated probabilities driving decisions; calibrate when probabilities matter.\n- **Grid search over tiny spaces** — wasting compute on 3x3 grids; randomized search over wide ranges.\n- **Target leakage in features** — features derived from the target; audit feature definitions.\n- **No random_state** — unreproducible results; seed everything.\n- **Metric\u002Fdecision mismatch** — optimizing AUC while the business needs precision@k; align metric to decision.\n",{"name":5,"category":24,"description":7},"development","main","af388a77c2fe5e0b4fd879cca4300a0ffa9a6579","skills\u002Fams-scikit-learn-pro",1,"https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis","https:\u002F\u002Fgithub.com\u002FTanNhatCMS","https:\u002F\u002Fmrkiet.name.vn","2026-11-07 14:23:08",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add TanNhatCMS\u002Fjarvis --skill scikit-learn-pro",{"tool":39,"command":40},"bunx","bunx skills add TanNhatCMS\u002Fjarvis --skill scikit-learn-pro",{"tool":42,"command":43},"pnpm","pnpm dlx skills add TanNhatCMS\u002Fjarvis --skill scikit-learn-pro","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Fams-scikit-learn-pro\u002FSKILL.md",true,[],[48,55,63,70,77,84],{"skillNo":49,"name":50,"nameZh":6,"description":51,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":52,"categories":53,"keywords":54,"publishedAt":19},"01M7EWYJR0J8DARY7E59Z6Y9MV","web-scrape","Turn web pages into LLM-ready markdown via the Firecrawl API (renders JS, anti-bot handling). Use when browser_open\u002Ffetch fails on JS-heavy pages, or when you need clean markdown\u002Fstructured extraction from a site. Requires FIRECRAWL_API_KEY.","https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Fweb-scrape\u002FSKILL.md",[],[],{"skillNo":56,"name":57,"nameZh":6,"description":58,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":59,"sourceHtmlUrl":60,"categories":61,"keywords":62,"publishedAt":19},"01M7EWYBN5P6F2AJG3FR24T9BP","design-taste-frontend","tasteskill v2, the anti-slop frontend skill. Art direction for websites, distilled from a study of 247 curated gallery sites (One Page Love, Awwwards Sites of the Day). Deals researched directions (idea, composition, type, palette, photographs, section blueprints) from a library, enforces a strict no-slop house style with a real-browser inspector, and runs a look-and-fix loop on screenshots. Use this whenever you build, design, redesign, restyle, polish or review a landing page, marketing site, portfolio, product page, one-pager, hero or any public-facing web page, in any stack (HTML\u002FCSS, React, Next.js, Vue, Svelte, Astro, Tailwind) — also when the user says a page looks generic, templated, \"AI-made\", sloppy, or asks to make it look designed, premium, award-level or less like every other site. Not for dashboards or app screens.","https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Ftaste-design\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Ftaste-design\u002FSKILL.md",[],[],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":19},"01M7EWY8FQFNQ2GB7NZZWGSSDX","test-driven-development","Use when implementing any feature or bugfix, before writing implementation code","https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Fsuperpowers-tdd\u002FSKILL.md",[],[],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":19},"01M7EWY5SHBFRH1HDHVWM9K7TV","systematic-debugging","Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes","https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Fsuperpowers-debugging\u002FSKILL.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":19},"01M7EWY3NM0Z0JAKS7HDZ24K66","requesting-code-review","Use when completing tasks, implementing major features, or before merging to verify work meets requirements","https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Fsuperpowers-code-review\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":19},"01M7EWY0WRMWX4M9ZFY0WKC593","brainstorming","You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).","https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Fsuperpowers-brainstorming\u002FSKILL.md",[],[]]