Alterlab scikit learn

From NVlabs/Skill2Env · View interactive version

Alterlab scikit learn is an AI agent skill from the GitHub repository NVlabs/Skill2Env. Classical machine learning in Python with scikit-learn — algorithms, preprocessing, pipelines, and best-practice reference documentation. Use when working with supervised learning (classification, regression), unsupervised learning (clustering, dimensionality reduction), model evaluation, hyperparam

How to use this skill

Skill file

Scikit-learn

Overview

This skill provides comprehensive guidance for machine learning tasks using scikit-learn, the industry-standard Python library for classical machine learning. Use this skill for classification, regression, clustering, dimensionality reduction, preprocessing, model evaluation, and building production-ready ML pipelines.

Installation

# Install scikit-learn using uv
uv pip install scikit-learn

# Optional: Install visualization dependencies
uv pip install matplotlib seaborn

# Commonly used with
uv pip install pandas numpy

When to Use This Skill

Use the scikit-learn skill when:

Quick Start

Minimal classification flow: stratified train_test_split → StandardScaler (fit on train only) → fit estimator → classification_report. For mixed numeric/categorical data, wrap preprocessing in a ColumnTransformer inside a Pipeline so it cross-validates without leakage.

See references/worked_examples.md for full copy-paste classification and mixed-data pipeline examples.

Core Capabilities

1. Supervised Learning

Comprehensive algorithms for classification and regression tasks.

Key algorithms:

When to use:

See: references/supervised_learning.md for detailed algorithm documentation, parameters, and usage examples.

2. Unsupervised Learning

Discover patterns in unlabeled data through clustering and dimensionality reduction.

Clustering algorithms:

Dimensionality reduction:

When to use:

See: references/unsupervised_learning.md for detailed documentation.

3. Model Evaluation and Selection

Tools for robust model evaluation, cross-validation, and hyperparameter tuning.

Cross-validation strategies:

Hyperparameter tuning:

Metrics:

When to use:

See: references/model_evaluation.md for comprehensive metrics and tuning strategies.

4. Data Preprocessing

Transform raw data into formats suitable for machine learning.

Scaling and normalization:

Encoding categorical variables:

Handling missing values:

Feature engineering:

When to use:

See: references/preprocessing.md for detailed preprocessing techniques.

5. Pipelines and Composition

Build reproducible, production-ready ML workflows.

Key components:

Benefits:

When to use:

See: references/pipelines_and_composition.md for comprehensive pipeline patterns.

Example Scripts

Two runnable end-to-end scripts ship with this skill:

python scripts/classification_pipeline.py   # mixed-data preprocessing, model comparison, GridSearchCV, evaluation, feature importance
python scripts/clustering_analysis.py        # optimal-k search, K-Means/DBSCAN/Agglomerative/GMM comparison, PCA visualization

See references/worked_examples.md for what each script demonstrates and standalone copy-paste versions.

Reference Documentation

This skill includes comprehensive reference files for deep dives into specific topics:

Quick Reference

File: references/quick_reference.md

Supervised Learning

File: references/supervised_learning.md

Unsupervised Learning

File: references/unsupervised_learning.md

Model Evaluation

File: references/model_evaluation.md

Preprocessing

File: references/preprocessing.md

Pipelines and Composition

File: references/pipelines_and_composition.md

Worked Examples

File: references/worked_examples.md

Best Practices & Troubleshooting

File: references/best_practices_and_troubleshooting.md

Common Workflows

See references/worked_examples.md for the numbered, copy-paste version of each workflow.

Best Practices (essentials)

See references/best_practices_and_troubleshooting.md for code examples and fixes for ConvergenceWarning, overfitting, and large-dataset memory errors.

Additional Resources

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.