Skill Tracer
Skills › Scientific Agent Skills › scikit-learn › core_capabilities.md

core_capabilities.md

140 lines · skills/scikit-learn/references/core_capabilities.md at 5f2bc03

Open on GitHub

Most marks come from matching words in the file, so treat them as pointers.

1# Core Capabilities
2
3Targets scikit-learn 1.9.1. Snippets with caller-supplied data/columns are illustrative; fit all learned preprocessing inside the training folds when estimating predictive performance.
4
5Supervised learning, unsupervised learning, model evaluation and selection, data
6preprocessing, and pipelines and composition. Per-topic detail is in the other reference
7files in this directory.
8

Core Capabilities

Targets scikit-learn 1.9.1. Snippets with caller-supplied data/columns are illustrative; fit all learned preprocessing inside the training folds when estimating predictive performance.

Supervised learning, unsupervised learning, model evaluation and selection, data preprocessing, and pipelines and composition. Per-topic detail is in the other reference files in this directory.

Raw lines 1 to 8
9## Core Capabilities

Core Capabilities

Raw lines 9 to 10
11### 1. Supervised Learning
13Comprehensive algorithms for classification and regression tasks.
15**Key algorithms:**
16- **Linear models**: Logistic Regression, Linear Regression, Ridge, Lasso, ElasticNet
17- **Tree-based**: Decision Trees, Random Forest, Gradient Boosting
18- **Support Vector Machines**: SVC, SVR with various kernels
19- **Ensemble methods**: AdaBoost, Voting, Stacking
20- **Neural Networks**: MLPClassifier, MLPRegressor
21- **Others**: Naive Bayes, K-Nearest Neighbors
23**When to use:**
24- Classification: Predicting discrete categories (spam detection, image classification, fraud detection)
25- Regression: Predicting continuous values (price prediction, demand forecasting)
27**See:** `references/supervised_learning.md` for detailed algorithm documentation, parameters, and usage examples.

1. Supervised Learning

Comprehensive algorithms for classification and regression tasks.

Key algorithms:

  • Linear models: Logistic Regression, Linear Regression, Ridge, Lasso, ElasticNet
  • Tree-based: Decision Trees, Random Forest, Gradient Boosting
  • Support Vector Machines: SVC, SVR with various kernels
  • Ensemble methods: AdaBoost, Voting, Stacking
  • Neural Networks: MLPClassifier, MLPRegressor
  • Others: Naive Bayes, K-Nearest Neighbors

When to use:

  • Classification: Predicting discrete categories (spam detection, image classification, fraud detection)
  • Regression: Predicting continuous values (price prediction, demand forecasting)

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

Raw lines 11 to 28
29### 2. Unsupervised Learning
31Discover patterns in unlabeled data through clustering and dimensionality reduction.
33**Clustering algorithms:**
34- **Partition-based**: K-Means, MiniBatchKMeans
35- **Density-based**: DBSCAN, HDBSCAN, OPTICS
36- **Hierarchical**: AgglomerativeClustering
37- **Probabilistic**: Gaussian Mixture Models
38- **Others**: MeanShift, SpectralClustering, BIRCH
40**Dimensionality reduction:**
41- **Linear**: PCA, TruncatedSVD, NMF
42- **Manifold learning**: t-SNE, Isomap, LLE, MDS, ClassicalMDS (1.8+)
43- **External (install separately)**: UMAP (`umap-learn`)
44- **Feature extraction**: FastICA, LatentDirichletAllocation
46**When to use:**
47- Customer segmentation, anomaly detection, data visualization
48- Reducing feature dimensions, exploratory data analysis
49- Topic modeling, image compression
51**See:** `references/unsupervised_learning.md` for detailed documentation.

2. Unsupervised Learning

Discover patterns in unlabeled data through clustering and dimensionality reduction.

Clustering algorithms:

  • Partition-based: K-Means, MiniBatchKMeans
  • Density-based: DBSCAN, HDBSCAN, OPTICS
  • Hierarchical: AgglomerativeClustering
  • Probabilistic: Gaussian Mixture Models
  • Others: MeanShift, SpectralClustering, BIRCH

Dimensionality reduction:

  • Linear: PCA, TruncatedSVD, NMF
  • Manifold learning: t-SNE, Isomap, LLE, MDS, ClassicalMDS (1.8+)
  • External (install separately): UMAP (umap-learn)
  • Feature extraction: FastICA, LatentDirichletAllocation

When to use:

  • Customer segmentation, anomaly detection, data visualization
  • Reducing feature dimensions, exploratory data analysis
  • Topic modeling, image compression

See: references/unsupervised_learning.md for detailed documentation.

Raw lines 29 to 52
Names a skill umap-learn :43
53### 3. Model Evaluation and Selection
55Tools for robust model evaluation, cross-validation, and hyperparameter tuning.
57**Cross-validation strategies:**
58- KFold, StratifiedKFold (classification)
59- TimeSeriesSplit (temporal data)
60- GroupKFold (grouped samples)
62**Hyperparameter tuning:**
63- GridSearchCV (exhaustive search)
64- RandomizedSearchCV (random sampling)
65- HalvingGridSearchCV (successive halving)
67**Metrics:**
68- **Classification**: accuracy, precision, recall, F1-score, ROC AUC, confusion matrix
69- **Regression**: MSE, RMSE, MAE, R², MAPE
70- **Clustering**: silhouette score, Calinski-Harabasz, Davies-Bouldin
72**When to use:**
73- Comparing model performance objectively
74- Finding optimal hyperparameters
75- Preventing overfitting through cross-validation
76- Understanding model behavior with learning curves
78**See:** `references/model_evaluation.md` for comprehensive metrics and tuning strategies.

3. Model Evaluation and Selection

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

Cross-validation strategies:

  • KFold, StratifiedKFold (classification)
  • TimeSeriesSplit (temporal data)
  • GroupKFold (grouped samples)

Hyperparameter tuning:

  • GridSearchCV (exhaustive search)
  • RandomizedSearchCV (random sampling)
  • HalvingGridSearchCV (successive halving)

Metrics:

  • Classification: accuracy, precision, recall, F1-score, ROC AUC, confusion matrix
  • Regression: MSE, RMSE, MAE, R², MAPE
  • Clustering: silhouette score, Calinski-Harabasz, Davies-Bouldin

When to use:

  • Comparing model performance objectively
  • Finding optimal hyperparameters
  • Preventing overfitting through cross-validation
  • Understanding model behavior with learning curves

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

Raw lines 53 to 79
80### 4. Data Preprocessing
82Transform raw data into formats suitable for machine learning.
84**Scaling and normalization:**
85- StandardScaler (zero mean, unit variance)
86- MinMaxScaler (bounded range)
87- RobustScaler (robust to outliers)
88- Normalizer (sample-wise normalization)
90**Encoding categorical variables:**
91- OneHotEncoder (nominal categories)
92- OrdinalEncoder (ordered categories)
93- LabelEncoder (target encoding)
95**Handling missing values:**
96- SimpleImputer (mean, median, most frequent)
97- KNNImputer (k-nearest neighbors)
98- IterativeImputer (multivariate imputation)
100**Feature engineering:**
101- PolynomialFeatures (interaction terms)
102- KBinsDiscretizer (binning)
103- Feature selection (RFE, SelectKBest, SelectFromModel)
105**When to use:**
106- Before training any algorithm that requires scaled features (SVM, KNN, Neural Networks)
107- Converting categorical variables to numeric format
108- Handling missing data systematically
109- Creating non-linear features for linear models
111**See:** `references/preprocessing.md` for detailed preprocessing techniques.

4. Data Preprocessing

Transform raw data into formats suitable for machine learning.

Scaling and normalization:

  • StandardScaler (zero mean, unit variance)
  • MinMaxScaler (bounded range)
  • RobustScaler (robust to outliers)
  • Normalizer (sample-wise normalization)

Encoding categorical variables:

  • OneHotEncoder (nominal categories)
  • OrdinalEncoder (ordered categories)
  • LabelEncoder (target encoding)

Handling missing values:

  • SimpleImputer (mean, median, most frequent)
  • KNNImputer (k-nearest neighbors)
  • IterativeImputer (multivariate imputation)

Feature engineering:

  • PolynomialFeatures (interaction terms)
  • KBinsDiscretizer (binning)
  • Feature selection (RFE, SelectKBest, SelectFromModel)

When to use:

  • Before training any algorithm that requires scaled features (SVM, KNN, Neural Networks)
  • Converting categorical variables to numeric format
  • Handling missing data systematically
  • Creating non-linear features for linear models

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

Raw lines 80 to 112
113### 5. Pipelines and Composition
115Build reproducible, production-ready ML workflows.
117**Key components:**
118- **Pipeline**: Chain transformers and estimators sequentially
119- **ColumnTransformer**: Apply different preprocessing to different columns
120- **FeatureUnion**: Combine multiple transformers in parallel
121- **TransformedTargetRegressor**: Transform target variable
123**Benefits:**
124- Prevents data leakage in cross-validation
125- Simplifies code and improves maintainability
126- Enables joint hyperparameter tuning
127- Ensures consistency between training and prediction
129**When to use:**
130- Always use Pipelines for production workflows
131- When mixing numerical and categorical features (use ColumnTransformer)
132- When performing cross-validation with preprocessing steps
133- When hyperparameter tuning includes preprocessing parameters
135**See:** `references/pipelines_and_composition.md` for comprehensive pipeline patterns.

5. Pipelines and Composition

Build reproducible, production-ready ML workflows.

Key components:

  • Pipeline: Chain transformers and estimators sequentially
  • ColumnTransformer: Apply different preprocessing to different columns
  • FeatureUnion: Combine multiple transformers in parallel
  • TransformedTargetRegressor: Transform target variable

Benefits:

  • Prevents data leakage in cross-validation
  • Simplifies code and improves maintainability
  • Enables joint hyperparameter tuning
  • Ensures consistency between training and prediction

When to use:

  • Always use Pipelines for production workflows
  • When mixing numerical and categorical features (use ColumnTransformer)
  • When performing cross-validation with preprocessing steps
  • When hyperparameter tuning includes preprocessing parameters

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

Raw lines 113 to 136
137## Upstream references
139- https://scikit-learn.org/stable/user_guide.html
140- https://scikit-learn.org/stable/api/index.html

Upstream references

  • https://scikit-learn.org/stable/user_guide.html
  • https://scikit-learn.org/stable/api/index.html
Raw lines 137 to 140