scikit-learn

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

Updated Sep 2, 2026
One-click install
npx skills add https://github.com/ricfulop/cba-agentic-engineering-bootstrap --skill scikit-learn-ricfulop
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: scikit-learn
Source: https://github.com/ricfulop/cba-agentic-engineering-bootstrap/tree/main/skills/scikit-learn
Command: npx skills add https://github.com/ricfulop/cba-agentic-engineering-bootstrap --skill scikit-learn-ricfulop

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Applying machine learning correctly requires choosing the right algorithm, preprocessing data without leakage, tuning hyperparameters, and evaluating models rigorously. This Skill provides comprehensive guidance and ready-to-run scripts for the full scikit-learn workflow, from raw data to validated models. ## Core Features & Use Cases - Supervised and Unsupervised Learning: Covers classification, regression, clustering, and dimensionality reduction with algorithm selection guidance. - Pipelines and Preprocessing: Build leakage-free workflows with Pipeline, ColumnTransformer, scalers, encoders, and imputers for mixed data types. - Model Evaluation and Tuning: Cross-validation strategies, GridSearchCV/RandomizedSearchCV, and classification, regression, and clustering metrics. - Use Case: Given a CSV with numeric and categorical columns, run the bundled classification pipeline script to compare Logistic Regression, Random Forest, and Gradient Boosting with cross-validation, tune the winner, and get a full evaluation report. ## Quick Start Ask the assistant to build a scikit-learn classification pipeline with preprocessing and hyperparameter tuning 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 prefixes like 'classifier__max_depth', then pass it with your pipeline to GridSearchCV with a cv value and scoring metric. Access the best configuration via best_params_ and the fitted model via best_estimator_.

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 scaling with StandardScaler or similar. Tree-based models like Random Forest and Gradient Boosting, plus Naive Bayes, work without scaling.

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

Overfitting happens when the model memorizes training data. Add regularization such as Ridge alpha, reduce model complexity, or use cross_val_score with 5-fold cross-validation to get an honest performance estimate before testing.

How do I handle imbalanced classes in scikit-learn?

Set class_weight='balanced' on estimators like RandomForestClassifier, and evaluate with balanced_accuracy_score, precision, recall, or ROC AUC instead of plain accuracy. For resampling, use SMOTE from the imbalanced-learn package.