SKILL.md--- name: scikit-learn description: Supports machine learning in Python with scikit-learn. Applies when working with supervised learning (classification, regression), unsupervised learning (clustering, dimensionality reduction), model evaluation, hyperparameter tuning, preprocessing, or building ML pipelines. Provides comprehensive reference documentation for algorithms, preprocessing techniques, pipelines, and best practices. license: BSD-3-Clause license allowed-tools: Read Write Edit Bash compatibility: Requires Python 3.11+ and scikit-learn 1.9.1. NumPy, SciPy, and joblib are dependencies; bundled scripts also require pandas and matplotlib. Installation needs network access; bundled examples use local datasets without credentials. metadata: version: "1.5" last-reviewed: "2026-10-01" upstream-version: "1.9.1" skill-author: K-Dense Inc. --- # 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 Targets **scikit-learn 1.9.1**, verified with Python 3.13. The release requires Python 3.11+; use its published wheels for your interpreter/platform. See the [1.9 release notes](https://scikit-learn.org/stable/whats_new/v1.9.html). The bundled scripts and regression tests are executable examples. Reference snippets using caller-provided `X`, `y`, columns, or placeholders are illustrative adaptations, not complete standalone programs. Install the PyPI package **`scikit-learn`** (not the deprecated `sklearn` package on PyPI). Import in code as `sklearn`. ```bash # Install scikit-learn using uv uv pip install "scikit-learn==1.9.1" # Optional: plotting utilities and bundled script dependencies uv pip install "scikit-learn[plots]==1.9.1" matplotlib pandas # Commonly used with uv pip install pandas numpy ``` Check your version: ```python import sklearn print(sklearn.__version__) ``` ## When to Use This Skill Use the scikit-learn skill when: - Building classification or regression models - Performing clustering or dimensionality reduction - Preprocessing and transforming data for machine learning - Evaluating model performance with cross-validation - Tuning hyperparameters with grid or random search - Creating ML pipelines for production workflows - Comparing different algorithms for a task - Working with both structured (tabular) and text data - Need interpretable, classical machine learning approaches ## Quick Start ### Classification Example ```python from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler from sklearn.ensemble import RandomForestClassifier from sklearn.metrics import classification_report # Spl