scikit-learn

Build, evaluate, and tune classical machine learning models in Python with scikit-learn.

Updated Aug 12, 2026
One-click install
npx skills add https://github.com/littlt-momo-c-yfc/skills --skill scikit-learn-littlt-momo-c-yfc
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: scikit-learn
Source: https://github.com/littlt-momo-c-yfc/skills/tree/main/skills/scientific-toolkit-skill/references/scientific-skills/scikit-learn
Command: npx skills add https://github.com/littlt-momo-c-yfc/skills --skill scikit-learn-littlt-momo-c-yfc

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires scikit-learn, numpy, pandas, matplotlib, and includes scripts (resource) and references (resource) components.

What problem does it solve? It guides you through the full classical machine learning workflow in Python—preprocessing raw data, training classification or regression models, clustering unlabeled data, tuning hyperparameters, and evaluating results—without having to memorize the scikit-learn API. ## Core Features & Use Cases - Supervised and Unsupervised Learning: Covers classification, regression, clustering, and dimensionality reduction algorithms with selection guidance. - Pipelines and Preprocessing: Builds reproducible workflows with Pipeline, ColumnTransformer, scaling, encoding, and imputation to prevent data leakage. - Model Evaluation and Tuning: Provides cross-validation strategies, GridSearchCV/RandomizedSearchCV tuning, and classification, regression, and clustering metrics. - Use Case: Given a CSV with mixed numeric and categorical columns, build a complete pipeline that imputes missing values, encodes categories, compares Random Forest against Gradient Boosting via cross-validation, tunes the winner, and reports test-set metrics. ## Quick Start Ask the agent to build a scikit-learn classification pipeline with preprocessing, hyperparameter tuning, and evaluation for your dataset.

Frequently Asked Questions about scikit-learn

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build a machine learning pipeline in scikit-learn?

Use sklearn.pipeline.Pipeline to chain transformers and an estimator, and ColumnTransformer to apply different preprocessing to numeric and categorical columns. Fitting the pipeline on training data only prevents data leakage during cross-validation.

How to tune hyperparameters with GridSearchCV in scikit-learn?

Define a parameter grid using step-name double-underscore syntax, then pass it with your pipeline to GridSearchCV with a cv and scoring setting. For large search spaces, RandomizedSearchCV samples parameter distributions more efficiently.

Which scikit-learn algorithm should I use for classification?

Logistic Regression is a fast interpretable baseline, Random Forest is a robust default, and Gradient Boosting often gives the best accuracy when tuned. SVM suits smaller datasets with complex boundaries, while Naive Bayes works well for text.

Does scikit-learn require feature scaling for all models?

No. SVM, KNN, neural networks, PCA, and regularized linear models require scaled features, typically via StandardScaler. Tree-based models like Random Forest and Gradient Boosting, plus Naive Bayes, do not require scaling.

Why does my scikit-learn model overfit on the test set?

Overfitting usually comes from insufficient regularization or evaluating without cross-validation. Add regularization such as Ridge alpha, use cross_val_score for honest estimates, and prefer simpler models or more training data.

How do I handle imbalanced classes in scikit-learn?

Set class_weight='balanced' on estimators like RandomForestClassifier, and evaluate with balanced accuracy, precision, recall, or ROC AUC instead of plain accuracy. For resampling, combine with imbalanced-learn's SMOTE in a pipeline.