scikit-learn

Build end-to-end scikit-learn workflows for classification, regression, clustering, and pipelines.

16|Updated Dec 28, 2025
One-click install
npx skills add https://github.com/Hongyu-yu/matsci-ai-skills --skill scikit-learn-hongyu-yu
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: scikit-learn
Source: https://github.com/Hongyu-yu/matsci-ai-skills/tree/main/skills/scikit-learn
Command: npx skills add https://github.com/Hongyu-yu/matsci-ai-skills --skill scikit-learn-hongyu-yu

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

Classification, regression, clustering, and pipeline tasks in scikit-learn can be daunting without structured guidance; this skill provides practical, end-to-end workflows, templates, and best practices to accelerate model development and deployment.

Core Features & Use Cases

  • End-to-end ML workflow guidance: data preprocessing, model selection, cross-validation, hyperparameter tuning, and persistence.
  • Algorithm coverage: linear models, tree-based methods, SVM, clustering, and ensemble techniques with practical examples and quick-start templates.
  • Pipelines and preprocessing patterns: ColumnTransformer, Pipelines, FeatureUnion, and best practices to prevent data leakage.

Quick Start

Load your dataset, define your feature groups, and run the included pipeline to train a model and evaluate its performance.

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 for preprocessing and model training in scikit-learn?

To build a machine learning pipeline, use scikit-learn's Pipeline and ColumnTransformer to chain data preprocessing steps and model training sequentially, preventing data leakage during cross-validation and ensuring production-ready workflows.

What is the best way to handle hyperparameter tuning for classification and regression models?

The best way to handle hyperparameter tuning is using scikit-learn's cross-validation tools like GridSearchCV or RandomizedSearchCV, which systematically evaluate parameter combinations to optimize model performance across classification and regression tasks.

How does cross-validation work when using pipelines with ColumnTransformer?

Cross-validation with pipelines works by applying data preprocessing transformations exclusively within each training fold, ensuring that validation data remains unseen by the ColumnTransformer, thus preventing data leakage and producing reliable model evaluation metrics.

Can I use scikit-learn for clustering and ensemble methods?

Yes, you can use scikit-learn for clustering and ensemble methods, providing algorithms ranging from KMeans for clustering to Random Forests and Gradient Boosting for ensemble learning, complete with model selection and evaluation workflows.

How do I persist trained models after hyperparameter tuning?

To persist trained models after hyperparameter tuning, use scikit-learn's built-in model persistence capabilities, typically leveraging joblib or pickle to save fitted pipelines and estimators for later production deployment and inference.