[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7CP31ZPJ2W2NXBEF889CFSF":3,"skill-same:01M7CP31ZPJ2W2NXBEF889CFSF":82},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":6,"ownerDescription":30,"updatedAt":31,"install":32,"resources":45},"01M7CP31ZPJ2W2NXBEF889CFSF","scikit-learn",null,"Machine learning in Python with scikit-learn. Use 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.","Carchaloneo22\u002FClaude-Code-template","Carchaloneo22","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F159488757?v=4","01M7CK5MQXAFZE3W7SAP69KNYR","Carlos Chaparro","01M7CK5MRFE26CDPEQDN5RSQPK",2,"MIT","https:\u002F\u002Fgithub.com\u002FCarchaloneo22\u002FClaude-Code-template\u002Fblob\u002Fadd-x-twitter-scraper-skill\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fscientific\u002Fscikit-learn\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: scikit-learn\ndescription: Machine learning in Python with scikit-learn. Use 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.\n---\n\n# Scikit-learn\n\n## Overview\n\nThis 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.\n\n## Installation\n\n```bash\n# Install scikit-learn using uv\nuv uv pip install scikit-learn\n\n# Optional: Install visualization dependencies\nuv uv pip install matplotlib seaborn\n\n# Commonly used with\nuv uv pip install pandas numpy\n```\n\n## When to Use This Skill\n\nUse the scikit-learn skill when:\n\n- Building classification or regression models\n- Performing clustering or dimensionality reduction\n- Preprocessing and transforming data for machine learning\n- Evaluating model performance with cross-validation\n- Tuning hyperparameters with grid or random search\n- Creating ML pipelines for production workflows\n- Comparing different algorithms for a task\n- Working with both structured (tabular) and text data\n- Need interpretable, classical machine learning approaches\n\n## Quick Start\n\n### Classification Example\n\n```python\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.preprocessing import StandardScaler\nfrom sklearn.ensemble import RandomForestClassifier\nfrom sklearn.metrics import classification_report\n\n# Split data\nX_train, X_test, y_train, y_test = train_test_split(\n    X, y, test_size=0.2, stratify=y, random_state=42\n)\n\n# Preprocess\nscaler = StandardScaler()\nX_train_scaled = scaler.fit_transform(X_train)\nX_test_scaled = scaler.transform(X_test)\n\n# Train model\nmodel = RandomForestClassifier(n_estimators=100, random_state=42)\nmodel.fit(X_train_scaled, y_train)\n\n# Evaluate\ny_pred = model.predict(X_test_scaled)\nprint(classification_report(y_test, y_pred))\n```\n\n### Complete Pipeline with Mixed Data\n\n```python\nfrom sklearn.pipeline import Pipeline\nfrom sklearn.compose import ColumnTransformer\nfrom sklearn.preprocessing import StandardScaler, OneHotEncoder\nfrom sklearn.impute import SimpleImputer\nfrom sklearn.ensemble import GradientBoostingClassifier\n\n# Define feature types\nnumeric_features = ['age', 'income']\ncategorical_features = ['gender', 'occupation']\n\n# Create preprocessing pipelines\nnumeric_transformer = Pipeline([\n    ('imputer', SimpleImputer(strategy='median')),\n    ('scaler', StandardScaler())\n])\n\ncategorical_transformer = Pipeline([\n    ('imputer', SimpleImputer(strategy='most_frequent')),\n    ('onehot', OneHotEncoder(handle_unknown='ignore'))\n])\n\n# Combine transformers\npreprocessor = ColumnTransformer([\n    ('num', numeric_transformer, numeric_features),\n    ('cat', categorical_transformer, categorical_features)\n])\n\n# Full pipeline\nmodel = Pipeline([\n    ('preprocessor', preprocessor),\n    ('classifier', GradientBoostingClassifier(random_state=42))\n])\n\n# Fit and predict\nmodel.fit(X_train, y_train)\ny_pred = model.predict(X_test)\n```\n\n## Core Capabilities\n\n### 1. Supervised Learning\n\nComprehensive algorithms for classification and regression tasks.\n\n**Key algorithms:**\n- **Linear models**: Logistic Regression, Linear Regression, Ridge, Lasso, ElasticNet\n- **Tree-based**: Decision Trees, Random Forest, Gradient Boosting\n- **Support Vector Machines**: SVC, SVR with various kernels\n- **Ensemble methods**: AdaBoost, Voting, Stacking\n- **Neural Networks**: MLPClassifier, MLPRegressor\n- **Others**: Naive Bayes, K-Nearest Neighbors\n\n**When to use:**\n- Classification: Predicting discrete categories (spam detection, image classification, fraud detection)\n- Regression: Predicting continuous values (price prediction, demand forecasting)\n\n**See:** `references\u002Fsupervised_learning.md` for detailed algorithm documentation, parameters, and usage examples.\n\n### 2. Unsupervised Learning\n\nDiscover patterns in unlabeled data through clustering and dimensionality reduction.\n\n**Clustering algorithms:**\n- **Partition-based**: K-Means, MiniBatchKMeans\n- **Density-based**: DBSCAN, HDBSCAN, OPTICS\n- **Hierarchical**: AgglomerativeClustering\n- **Probabilistic**: Gaussian Mixture Models\n- **Others**: MeanShift, SpectralClustering, BIRCH\n\n**Dimensionality reduction:**\n- **Linear**: PCA, TruncatedSVD, NMF\n- **Manifold learning**: t-SNE, UMAP, Isomap, LLE\n- **Feature extraction**: FastICA, LatentDirichletAllocation\n\n**When to use:**\n- Customer segmentation, anomaly detection, data visualization\n- Reducing feature dimensions, exploratory data analysis\n- Topic modeling, image compression\n\n**See:** `references\u002Funsupervised_learning.md` for detailed documentation.\n\n### 3. Model Evaluation and Selection\n\nTools for robust model evaluation, cross-validation, and hyperparameter tuning.\n\n**Cross-validation strategies:**\n- KFold, StratifiedKFold (classification)\n- TimeSeriesSplit (temporal data)\n- GroupKFold (grouped samples)\n\n**Hyperparameter tuning:**\n- GridSearchCV (exhaustive search)\n- RandomizedSearchCV (random sampling)\n- HalvingGridSearchCV (successive halving)\n\n**Metrics:**\n- **Classification**: accuracy, precision, recall, F1-score, ROC AUC, confusion matrix\n- **Regression**: MSE, RMSE, MAE, R², MAPE\n- **Clustering**: silhouette score, Calinski-Harabasz, Davies-Bouldin\n\n**When to use:**\n- Comparing model performance objectively\n- Finding optimal hyperparameters\n- Preventing overfitting through cross-validation\n- Understanding model behavior with learning curves\n\n**See:** `references\u002Fmodel_evaluation.md` for comprehensive metrics and tuning strategies.\n\n### 4. Data Preprocessing\n\nTransform raw data into formats suitable for machine learning.\n\n**Scaling and normalization:**\n- StandardScaler (zero mean, unit variance)\n- MinMaxScaler (bounded range)\n- RobustScaler (robust to outliers)\n- Normalizer (sample-wise normalization)\n\n**Encoding categorical variables:**\n- OneHotEncoder (nominal categories)\n- OrdinalEncoder (ordered categories)\n- LabelEncoder (target encoding)\n\n**Handling missing values:**\n- SimpleImputer (mean, median, most frequent)\n- KNNImputer (k-nearest neighbors)\n- IterativeImputer (multivariate imputation)\n\n**Feature engineering:**\n- PolynomialFeatures (interaction terms)\n- KBinsDiscretizer (binning)\n- Feature selection (RFE, SelectKBest, SelectFromModel)\n\n**When to use:**\n- Before training any algorithm that requires scaled features (SVM, KNN, Neural Networks)\n- Converting categorical variables to numeric format\n- Handling missing data systematically\n- Creating non-linear features for linear models\n\n**See:** `references\u002Fpreprocessing.md` for detailed preprocessing techniques.\n\n### 5. Pipelines and Composition\n\nBuild reproducible, production-ready ML workflows.\n\n**Key components:**\n- **Pipeline**: Chain transformers and estimators sequentially\n- **ColumnTransformer**: Apply different preprocessing to different columns\n- **FeatureUnion**: Combine multiple transformers in parallel\n- **TransformedTargetRegressor**: Transform target variable\n\n**Benefits:**\n- Prevents data leakage in cross-validation\n- Simplifies code and improves maintainability\n- Enables joint hyperparameter tuning\n- Ensures consistency between training and prediction\n\n**When to use:**\n- Always use Pipelines for production workflows\n- When mixing numerical and categorical features (use ColumnTransformer)\n- When performing cross-validation with preprocessing steps\n- When hyperparameter tuning includes preprocessing parameters\n\n**See:** `references\u002Fpipelines_and_composition.md` for comprehensive pipeline patterns.\n\n## Example Scripts\n\n### Classification Pipeline\n\nRun a complete classification workflow with preprocessing, model comparison, hyperparameter tuning, and evaluation:\n\n```bash\npython scripts\u002Fclassification_pipeline.py\n```\n\nThis script demonstrates:\n- Handling mixed data types (numeric and categorical)\n- Model comparison using cross-validation\n- Hyperparameter tuning with GridSearchCV\n- Comprehensive evaluation with multiple metrics\n- Feature importance analysis\n\n### Clustering Analysis\n\nPerform clustering analysis with algorithm comparison and visualization:\n\n```bash\npython scripts\u002Fclustering_analysis.py\n```\n\nThis script demonstrates:\n- Finding optimal number of clusters (elbow method, silhouette analysis)\n- Comparing multiple clustering algorithms (K-Means, DBSCAN, Agglomerative, Gaussian Mixture)\n- Evaluating clustering quality without ground truth\n- Visualizing results with PCA projection\n\n## Reference Documentation\n\nThis skill includes comprehensive reference files for deep dives into specific topics:\n\n### Quick Reference\n**File:** `references\u002Fquick_reference.md`\n- Common import patterns and installation instructions\n- Quick workflow templates for common tasks\n- Algorithm selection cheat sheets\n- Common patterns and gotchas\n- Performance optimization tips\n\n### Supervised Learning\n**File:** `references\u002Fsupervised_learning.md`\n- Linear models (regression and classification)\n- Support Vector Machines\n- Decision Trees and ensemble methods\n- K-Nearest Neighbors, Naive Bayes, Neural Networks\n- Algorithm selection guide\n\n### Unsupervised Learning\n**File:** `references\u002Funsupervised_learning.md`\n- All clustering algorithms with parameters and use cases\n- Dimensionality reduction techniques\n- Outlier and novelty detection\n- Gaussian Mixture Models\n- Method selection guide\n\n### Model Evaluation\n**File:** `references\u002Fmodel_evaluation.md`\n- Cross-validation strategies\n- Hyperparameter tuning methods\n- Classification, regression, and clustering metrics\n- Learning and validation curves\n- Best practices for model selection\n\n### Preprocessing\n**File:** `references\u002Fpreprocessing.md`\n- Feature scaling and normalization\n- Encoding categorical variables\n- Missing value imputation\n- Feature engineering techniques\n- Custom transformers\n\n### Pipelines and Composition\n**File:** `references\u002Fpipelines_and_composition.md`\n- Pipeline construction and usage\n- ColumnTransformer for mixed data types\n- FeatureUnion for parallel transformations\n- Complete end-to-end examples\n- Best practices\n\n## Common Workflows\n\n### Building a Classification Model\n\n1. **Load and explore data**\n   ```python\n   import pandas as pd\n   df = pd.read_csv('data.csv')\n   X = df.drop('target', axis=1)\n   y = df['target']\n   ```\n\n2. **Split data with stratification**\n   ```python\n   from sklearn.model_selection import train_test_split\n   X_train, X_test, y_train, y_test = train_test_split(\n       X, y, test_size=0.2, stratify=y, random_state=42\n   )\n   ```\n\n3. **Create preprocessing pipeline**\n   ```python\n   from sklearn.pipeline import Pipeline\n   from sklearn.preprocessing import StandardScaler\n   from sklearn.compose import ColumnTransformer\n\n   # Handle numeric and categorical features separately\n   preprocessor = ColumnTransformer([\n       ('num', StandardScaler(), numeric_features),\n       ('cat', OneHotEncoder(), categorical_features)\n   ])\n   ```\n\n4. **Build complete pipeline**\n   ```python\n   model = Pipeline([\n       ('preprocessor', preprocessor),\n       ('classifier', RandomForestClassifier(random_state=42))\n   ])\n   ```\n\n5. **Tune hyperparameters**\n   ```python\n   from sklearn.model_selection import GridSearchCV\n\n   param_grid = {\n       'classifier__n_estimators': [100, 200],\n       'classifier__max_depth': [10, 20, None]\n   }\n\n   grid_search = GridSearchCV(model, param_grid, cv=5)\n   grid_search.fit(X_train, y_train)\n   ```\n\n6. **Evaluate on test set**\n   ```python\n   from sklearn.metrics import classification_report\n\n   best_model = grid_search.best_estimator_\n   y_pred = best_model.predict(X_test)\n   print(classification_report(y_test, y_pred))\n   ```\n\n### Performing Clustering Analysis\n\n1. **Preprocess data**\n   ```python\n   from sklearn.preprocessing import StandardScaler\n\n   scaler = StandardScaler()\n   X_scaled = scaler.fit_transform(X)\n   ```\n\n2. **Find optimal number of clusters**\n   ```python\n   from sklearn.cluster import KMeans\n   from sklearn.metrics import silhouette_score\n\n   scores = []\n   for k in range(2, 11):\n       kmeans = KMeans(n_clusters=k, random_state=42)\n       labels = kmeans.fit_predict(X_scaled)\n       scores.append(silhouette_score(X_scaled, labels))\n\n   optimal_k = range(2, 11)[np.argmax(scores)]\n   ```\n\n3. **Apply clustering**\n   ```python\n   model = KMeans(n_clusters=optimal_k, random_state=42)\n   labels = model.fit_predict(X_scaled)\n   ```\n\n4. **Visualize with dimensionality reduction**\n   ```python\n   from sklearn.decomposition import PCA\n\n   pca = PCA(n_components=2)\n   X_2d = pca.fit_transform(X_scaled)\n\n   plt.scatter(X_2d[:, 0], X_2d[:, 1], c=labels, cmap='viridis')\n   ```\n\n## Best Practices\n\n### Always Use Pipelines\nPipelines prevent data leakage and ensure consistency:\n```python\n# Good: Preprocessing in pipeline\npipeline = Pipeline([\n    ('scaler', StandardScaler()),\n    ('model', LogisticRegression())\n])\n\n# Bad: Preprocessing outside (can leak information)\nX_scaled = StandardScaler().fit_transform(X)\n```\n\n### Fit on Training Data Only\nNever fit on test data:\n```python\n# Good\nscaler = StandardScaler()\nX_train_scaled = scaler.fit_transform(X_train)\nX_test_scaled = scaler.transform(X_test)  # Only transform\n\n# Bad\nscaler = StandardScaler()\nX_all_scaled = scaler.fit_transform(np.vstack([X_train, X_test]))\n```\n\n### Use Stratified Splitting for Classification\nPreserve class distribution:\n```python\nX_train, X_test, y_train, y_test = train_test_split(\n    X, y, test_size=0.2, stratify=y, random_state=42\n)\n```\n\n### Set Random State for Reproducibility\n```python\nmodel = RandomForestClassifier(n_estimators=100, random_state=42)\n```\n\n### Choose Appropriate Metrics\n- Balanced data: Accuracy, F1-score\n- Imbalanced data: Precision, Recall, ROC AUC, Balanced Accuracy\n- Cost-sensitive: Define custom scorer\n\n### Scale Features When Required\nAlgorithms requiring feature scaling:\n- SVM, KNN, Neural Networks\n- PCA, Linear\u002FLogistic Regression with regularization\n- K-Means clustering\n\nAlgorithms not requiring scaling:\n- Tree-based models (Decision Trees, Random Forest, Gradient Boosting)\n- Naive Bayes\n\n## Troubleshooting Common Issues\n\n### ConvergenceWarning\n**Issue:** Model didn't converge\n**Solution:** Increase `max_iter` or scale features\n```python\nmodel = LogisticRegression(max_iter=1000)\n```\n\n### Poor Performance on Test Set\n**Issue:** Overfitting\n**Solution:** Use regularization, cross-validation, or simpler model\n```python\n# Add regularization\nmodel = Ridge(alpha=1.0)\n\n# Use cross-validation\nscores = cross_val_score(model, X, y, cv=5)\n```\n\n### Memory Error with Large Datasets\n**Solution:** Use algorithms designed for large data\n```python\n# Use SGD for large datasets\nfrom sklearn.linear_model import SGDClassifier\nmodel = SGDClassifier()\n\n# Or MiniBatchKMeans for clustering\nfrom sklearn.cluster import MiniBatchKMeans\nmodel = MiniBatchKMeans(n_clusters=8, batch_size=100)\n```\n\n## Additional Resources\n\n- Official Documentation: https:\u002F\u002Fscikit-learn.org\u002Fstable\u002F\n- User Guide: https:\u002F\u002Fscikit-learn.org\u002Fstable\u002Fuser_guide.html\n- API Reference: https:\u002F\u002Fscikit-learn.org\u002Fstable\u002Fapi\u002Findex.html\n- Examples Gallery: https:\u002F\u002Fscikit-learn.org\u002Fstable\u002Fauto_examples\u002Findex.html\n","# Scikit-learn\n\n## Overview\n\nThis 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.\n\n## Installation\n\n```bash\n# Install scikit-learn using uv\nuv uv pip install scikit-learn\n\n# Optional: Install visualization dependencies\nuv uv pip install matplotlib seaborn\n\n# Commonly used with\nuv uv pip install pandas numpy\n```\n\n## When to Use This Skill\n\nUse the scikit-learn skill when:\n\n- Building classification or regression models\n- Performing clustering or dimensionality reduction\n- Preprocessing and transforming data for machine learning\n- Evaluating model performance with cross-validation\n- Tuning hyperparameters with grid or random search\n- Creating ML pipelines for production workflows\n- Comparing different algorithms for a task\n- Working with both structured (tabular) and text data\n- Need interpretable, classical machine learning approaches\n\n## Quick Start\n\n### Classification Example\n\n```python\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.preprocessing import StandardScaler\nfrom sklearn.ensemble import RandomForestClassifier\nfrom sklearn.metrics import classification_report\n\n# Split data\nX_train, X_test, y_train, y_test = train_test_split(\n    X, y, test_size=0.2, stratify=y, random_state=42\n)\n\n# Preprocess\nscaler = StandardScaler()\nX_train_scaled = scaler.fit_transform(X_train)\nX_test_scaled = scaler.transform(X_test)\n\n# Train model\nmodel = RandomForestClassifier(n_estimators=100, random_state=42)\nmodel.fit(X_train_scaled, y_train)\n\n# Evaluate\ny_pred = model.predict(X_test_scaled)\nprint(classification_report(y_test, y_pred))\n```\n\n### Complete Pipeline with Mixed Data\n\n```python\nfrom sklearn.pipeline import Pipeline\nfrom sklearn.compose import ColumnTransformer\nfrom sklearn.preprocessing import StandardScaler, OneHotEncoder\nfrom sklearn.impute import SimpleImputer\nfrom sklearn.ensemble import GradientBoostingClassifier\n\n# Define feature types\nnumeric_features = ['age', 'income']\ncategorical_features = ['gender', 'occupation']\n\n# Create preprocessing pipelines\nnumeric_transformer = Pipeline([\n    ('imputer', SimpleImputer(strategy='median')),\n    ('scaler', StandardScaler())\n])\n\ncategorical_transformer = Pipeline([\n    ('imputer', SimpleImputer(strategy='most_frequent')),\n    ('onehot', OneHotEncoder(handle_unknown='ignore'))\n])\n\n# Combine transformers\npreprocessor = ColumnTransformer([\n    ('num', numeric_transformer, numeric_features),\n    ('cat', categorical_transformer, categorical_features)\n])\n\n# Full pipeline\nmodel = Pipeline([\n    ('preprocessor', preprocessor),\n    ('classifier', GradientBoostingClassifier(random_state=42))\n])\n\n# Fit and predict\nmodel.fit(X_train, y_train)\ny_pred = model.predict(X_test)\n```\n\n## Core Capabilities\n\n### 1. Supervised Learning\n\nComprehensive algorithms for classification and regression tasks.\n\n**Key algorithms:**\n- **Linear models**: Logistic Regression, Linear Regression, Ridge, Lasso, ElasticNet\n- **Tree-based**: Decision Trees, Random Forest, Gradient Boosting\n- **Support Vector Machines**: SVC, SVR with various kernels\n- **Ensemble methods**: AdaBoost, Voting, Stacking\n- **Neural Networks**: MLPClassifier, MLPRegressor\n- **Others**: Naive Bayes, K-Nearest Neighbors\n\n**When to use:**\n- Classification: Predicting discrete categories (spam detection, image classification, fraud detection)\n- Regression: Predicting continuous values (price prediction, demand forecasting)\n\n**See:** `references\u002Fsupervised_learning.md` for detailed algorithm documentation, parameters, and usage examples.\n\n### 2. Unsupervised Learning\n\nDiscover patterns in unlabeled data through clustering and dimensionality reduction.\n\n**Clustering algorithms:**\n- **Partition-based**: K-Means, MiniBatchKMeans\n- **Density-based**: DBSCAN, HDBSCAN, OPTICS\n- **Hierarchical**: AgglomerativeClustering\n- **Probabilistic**: Gaussian Mixture Models\n- **Others**: MeanShift, SpectralClustering, BIRCH\n\n**Dimensionality reduction:**\n- **Linear**: PCA, TruncatedSVD, NMF\n- **Manifold learning**: t-SNE, UMAP, Isomap, LLE\n- **Feature extraction**: FastICA, LatentDirichletAllocation\n\n**When to use:**\n- Customer segmentation, anomaly detection, data visualization\n- Reducing feature dimensions, exploratory data analysis\n- Topic modeling, image compression\n\n**See:** `references\u002Funsupervised_learning.md` for detailed documentation.\n\n### 3. Model Evaluation and Selection\n\nTools for robust model evaluation, cross-validation, and hyperparameter tuning.\n\n**Cross-validation strategies:**\n- KFold, StratifiedKFold (classification)\n- TimeSeriesSplit (temporal data)\n- GroupKFold (grouped samples)\n\n**Hyperparameter tuning:**\n- GridSearchCV (exhaustive search)\n- RandomizedSearchCV (random sampling)\n- HalvingGridSearchCV (successive halving)\n\n**Metrics:**\n- **Classification**: accuracy, precision, recall, F1-score, ROC AUC, confusion matrix\n- **Regression**: MSE, RMSE, MAE, R², MAPE\n- **Clustering**: silhouette score, Calinski-Harabasz, Davies-Bouldin\n\n**When to use:**\n- Comparing model performance objectively\n- Finding optimal hyperparameters\n- Preventing overfitting through cross-validation\n- Understanding model behavior with learning curves\n\n**See:** `references\u002Fmodel_evaluation.md` for comprehensive metrics and tuning strategies.\n\n### 4. Data Preprocessing\n\nTransform raw data into formats suitable for machine learning.\n\n**Scaling and normalization:**\n- StandardScaler (zero mean, unit variance)\n- MinMaxScaler (bounded range)\n- RobustScaler (robust to outliers)\n- Normalizer (sample-wise normalization)\n\n**Encoding categorical variables:**\n- OneHotEncoder (nominal categories)\n- OrdinalEncoder (ordered categories)\n- LabelEncoder (target encoding)\n\n**Handling missing values:**\n- SimpleImputer (mean, median, most frequent)\n- KNNImputer (k-nearest neighbors)\n- IterativeImputer (multivariate imputation)\n\n**Feature engineering:**\n- PolynomialFeatures (interaction terms)\n- KBinsDiscretizer (binning)\n- Feature selection (RFE, SelectKBest, SelectFromModel)\n\n**When to use:**\n- Before training any algorithm that requires scaled features (SVM, KNN, Neural Networks)\n- Converting categorical variables to numeric format\n- Handling missing data systematically\n- Creating non-linear features for linear models\n\n**See:** `references\u002Fpreprocessing.md` for detailed preprocessing techniques.\n\n### 5. Pipelines and Composition\n\nBuild reproducible, production-ready ML workflows.\n\n**Key components:**\n- **Pipeline**: Chain transformers and estimators sequentially\n- **ColumnTransformer**: Apply different preprocessing to different columns\n- **FeatureUnion**: Combine multiple transformers in parallel\n- **TransformedTargetRegressor**: Transform target variable\n\n**Benefits:**\n- Prevents data leakage in cross-validation\n- Simplifies code and improves maintainability\n- Enables joint hyperparameter tuning\n- Ensures consistency between training and prediction\n\n**When to use:**\n- Always use Pipelines for production workflows\n- When mixing numerical and categorical features (use ColumnTransformer)\n- When performing cross-validation with preprocessing steps\n- When hyperparameter tuning includes preprocessing parameters\n\n**See:** `references\u002Fpipelines_and_composition.md` for comprehensive pipeline patterns.\n\n## Example Scripts\n\n### Classification Pipeline\n\nRun a complete classification workflow with preprocessing, model comparison, hyperparameter tuning, and evaluation:\n\n```bash\npython scripts\u002Fclassification_pipeline.py\n```\n\nThis script demonstrates:\n- Handling mixed data types (numeric and categorical)\n- Model comparison using cross-validation\n- Hyperparameter tuning with GridSearchCV\n- Comprehensive evaluation with multiple metrics\n- Feature importance analysis\n\n### Clustering Analysis\n\nPerform clustering analysis with algorithm comparison and visualization:\n\n```bash\npython scripts\u002Fclustering_analysis.py\n```\n\nThis script demonstrates:\n- Finding optimal number of clusters (elbow method, silhouette analysis)\n- Comparing multiple clustering algorithms (K-Means, DBSCAN, Agglomerative, Gaussian Mixture)\n- Evaluating clustering quality without ground truth\n- Visualizing results with PCA projection\n\n## Reference Documentation\n\nThis skill includes comprehensive reference files for deep dives into specific topics:\n\n### Quick Reference\n**File:** `references\u002Fquick_reference.md`\n- Common import patterns and installation instructions\n- Quick workflow templates for common tasks\n- Algorithm selection cheat sheets\n- Common patterns and gotchas\n- Performance optimization tips\n\n### Supervised Learning\n**File:** `references\u002Fsupervised_learning.md`\n- Linear models (regression and classification)\n- Support Vector Machines\n- Decision Trees and ensemble methods\n- K-Nearest Neighbors, Naive Bayes, Neural Networks\n- Algorithm selection guide\n\n### Unsupervised Learning\n**File:** `references\u002Funsupervised_learning.md`\n- All clustering algorithms with parameters and use cases\n- Dimensionality reduction techniques\n- Outlier and novelty detection\n- Gaussian Mixture Models\n- Method selection guide\n\n### Model Evaluation\n**File:** `references\u002Fmodel_evaluation.md`\n- Cross-validation strategies\n- Hyperparameter tuning methods\n- Classification, regression, and clustering metrics\n- Learning and validation curves\n- Best practices for model selection\n\n### Preprocessing\n**File:** `references\u002Fpreprocessing.md`\n- Feature scaling and normalization\n- Encoding categorical variables\n- Missing value imputation\n- Feature engineering techniques\n- Custom transformers\n\n### Pipelines and Composition\n**File:** `references\u002Fpipelines_and_composition.md`\n- Pipeline construction and usage\n- ColumnTransformer for mixed data types\n- FeatureUnion for parallel transformations\n- Complete end-to-end examples\n- Best practices\n\n## Common Workflows\n\n### Building a Classification Model\n\n1. **Load and explore data**\n   ```python\n   import pandas as pd\n   df = pd.read_csv('data.csv')\n   X = df.drop('target', axis=1)\n   y = df['target']\n   ```\n\n2. **Split data with stratification**\n   ```python\n   from sklearn.model_selection import train_test_split\n   X_train, X_test, y_train, y_test = train_test_split(\n       X, y, test_size=0.2, stratify=y, random_state=42\n   )\n   ```\n\n3. **Create preprocessing pipeline**\n   ```python\n   from sklearn.pipeline import Pipeline\n   from sklearn.preprocessing import StandardScaler\n   from sklearn.compose import ColumnTransformer\n\n   # Handle numeric and categorical features separately\n   preprocessor = ColumnTransformer([\n       ('num', StandardScaler(), numeric_features),\n       ('cat', OneHotEncoder(), categorical_features)\n   ])\n   ```\n\n4. **Build complete pipeline**\n   ```python\n   model = Pipeline([\n       ('preprocessor', preprocessor),\n       ('classifier', RandomForestClassifier(random_state=42))\n   ])\n   ```\n\n5. **Tune hyperparameters**\n   ```python\n   from sklearn.model_selection import GridSearchCV\n\n   param_grid = {\n       'classifier__n_estimators': [100, 200],\n       'classifier__max_depth': [10, 20, None]\n   }\n\n   grid_search = GridSearchCV(model, param_grid, cv=5)\n   grid_search.fit(X_train, y_train)\n   ```\n\n6. **Evaluate on test set**\n   ```python\n   from sklearn.metrics import classification_report\n\n   best_model = grid_search.best_estimator_\n   y_pred = best_model.predict(X_test)\n   print(classification_report(y_test, y_pred))\n   ```\n\n### Performing Clustering Analysis\n\n1. **Preprocess data**\n   ```python\n   from sklearn.preprocessing import StandardScaler\n\n   scaler = StandardScaler()\n   X_scaled = scaler.fit_transform(X)\n   ```\n\n2. **Find optimal number of clusters**\n   ```python\n   from sklearn.cluster import KMeans\n   from sklearn.metrics import silhouette_score\n\n   scores = []\n   for k in range(2, 11):\n       kmeans = KMeans(n_clusters=k, random_state=42)\n       labels = kmeans.fit_predict(X_scaled)\n       scores.append(silhouette_score(X_scaled, labels))\n\n   optimal_k = range(2, 11)[np.argmax(scores)]\n   ```\n\n3. **Apply clustering**\n   ```python\n   model = KMeans(n_clusters=optimal_k, random_state=42)\n   labels = model.fit_predict(X_scaled)\n   ```\n\n4. **Visualize with dimensionality reduction**\n   ```python\n   from sklearn.decomposition import PCA\n\n   pca = PCA(n_components=2)\n   X_2d = pca.fit_transform(X_scaled)\n\n   plt.scatter(X_2d[:, 0], X_2d[:, 1], c=labels, cmap='viridis')\n   ```\n\n## Best Practices\n\n### Always Use Pipelines\nPipelines prevent data leakage and ensure consistency:\n```python\n# Good: Preprocessing in pipeline\npipeline = Pipeline([\n    ('scaler', StandardScaler()),\n    ('model', LogisticRegression())\n])\n\n# Bad: Preprocessing outside (can leak information)\nX_scaled = StandardScaler().fit_transform(X)\n```\n\n### Fit on Training Data Only\nNever fit on test data:\n```python\n# Good\nscaler = StandardScaler()\nX_train_scaled = scaler.fit_transform(X_train)\nX_test_scaled = scaler.transform(X_test)  # Only transform\n\n# Bad\nscaler = StandardScaler()\nX_all_scaled = scaler.fit_transform(np.vstack([X_train, X_test]))\n```\n\n### Use Stratified Splitting for Classification\nPreserve class distribution:\n```python\nX_train, X_test, y_train, y_test = train_test_split(\n    X, y, test_size=0.2, stratify=y, random_state=42\n)\n```\n\n### Set Random State for Reproducibility\n```python\nmodel = RandomForestClassifier(n_estimators=100, random_state=42)\n```\n\n### Choose Appropriate Metrics\n- Balanced data: Accuracy, F1-score\n- Imbalanced data: Precision, Recall, ROC AUC, Balanced Accuracy\n- Cost-sensitive: Define custom scorer\n\n### Scale Features When Required\nAlgorithms requiring feature scaling:\n- SVM, KNN, Neural Networks\n- PCA, Linear\u002FLogistic Regression with regularization\n- K-Means clustering\n\nAlgorithms not requiring scaling:\n- Tree-based models (Decision Trees, Random Forest, Gradient Boosting)\n- Naive Bayes\n\n## Troubleshooting Common Issues\n\n### ConvergenceWarning\n**Issue:** Model didn't converge\n**Solution:** Increase `max_iter` or scale features\n```python\nmodel = LogisticRegression(max_iter=1000)\n```\n\n### Poor Performance on Test Set\n**Issue:** Overfitting\n**Solution:** Use regularization, cross-validation, or simpler model\n```python\n# Add regularization\nmodel = Ridge(alpha=1.0)\n\n# Use cross-validation\nscores = cross_val_score(model, X, y, cv=5)\n```\n\n### Memory Error with Large Datasets\n**Solution:** Use algorithms designed for large data\n```python\n# Use SGD for large datasets\nfrom sklearn.linear_model import SGDClassifier\nmodel = SGDClassifier()\n\n# Or MiniBatchKMeans for clustering\nfrom sklearn.cluster import MiniBatchKMeans\nmodel = MiniBatchKMeans(n_clusters=8, batch_size=100)\n```\n\n## Additional Resources\n\n- Official Documentation: https:\u002F\u002Fscikit-learn.org\u002Fstable\u002F\n- User Guide: https:\u002F\u002Fscikit-learn.org\u002Fstable\u002Fuser_guide.html\n- API Reference: https:\u002F\u002Fscikit-learn.org\u002Fstable\u002Fapi\u002Findex.html\n- Examples Gallery: https:\u002F\u002Fscikit-learn.org\u002Fstable\u002Fauto_examples\u002Findex.html\n",{"name":5,"description":7},"add-x-twitter-scraper-skill","7bc347b2f7dc2dde2761a965585925e0d0171748","cli-tool\u002Fcomponents\u002Fskills\u002Fscientific\u002Fscikit-learn",0,"https:\u002F\u002Fgithub.com\u002FCarchaloneo22\u002FClaude-Code-template","https:\u002F\u002Fgithub.com\u002FCarchaloneo22","Ingeniero Informático | Ingeniero en Desarrollo de Software | Consultor TIC en Gestión Publica | Docente Análisis y Desarrollo de Software. ","2026-09-12 11:10:56",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add Carchaloneo22\u002FClaude-Code-template --skill scikit-learn",{"tool":38,"command":39},"bunx","bunx skills add Carchaloneo22\u002FClaude-Code-template --skill scikit-learn",{"tool":41,"command":42},"pnpm","pnpm dlx skills add Carchaloneo22\u002FClaude-Code-template --skill scikit-learn","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FCarchaloneo22\u002FClaude-Code-template\u002Fblob\u002Fadd-x-twitter-scraper-skill\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fscientific\u002Fscikit-learn\u002FSKILL.md",true,[46,52,56,60,64,68,72,78],{"path":47,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":50,"sourceHtmlUrl":51},"references\u002Fmodel_evaluation.md","REFERENCE","参考文档",15454,"https:\u002F\u002Fgithub.com\u002FCarchaloneo22\u002FClaude-Code-template\u002Fblob\u002Fadd-x-twitter-scraper-skill\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fscientific\u002Fscikit-learn\u002Freferences\u002Fmodel_evaluation.md",{"path":53,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":54,"sourceHtmlUrl":55},"references\u002Fpipelines_and_composition.md",14770,"https:\u002F\u002Fgithub.com\u002FCarchaloneo22\u002FClaude-Code-template\u002Fblob\u002Fadd-x-twitter-scraper-skill\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fscientific\u002Fscikit-learn\u002Freferences\u002Fpipelines_and_composition.md",{"path":57,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":58,"sourceHtmlUrl":59},"references\u002Fpreprocessing.md",15603,"https:\u002F\u002Fgithub.com\u002FCarchaloneo22\u002FClaude-Code-template\u002Fblob\u002Fadd-x-twitter-scraper-skill\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fscientific\u002Fscikit-learn\u002Freferences\u002Fpreprocessing.md",{"path":61,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":62,"sourceHtmlUrl":63},"references\u002Fquick_reference.md",11508,"https:\u002F\u002Fgithub.com\u002FCarchaloneo22\u002FClaude-Code-template\u002Fblob\u002Fadd-x-twitter-scraper-skill\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fscientific\u002Fscikit-learn\u002Freferences\u002Fquick_reference.md",{"path":65,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":66,"sourceHtmlUrl":67},"references\u002Fsupervised_learning.md",11011,"https:\u002F\u002Fgithub.com\u002FCarchaloneo22\u002FClaude-Code-template\u002Fblob\u002Fadd-x-twitter-scraper-skill\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fscientific\u002Fscikit-learn\u002Freferences\u002Fsupervised_learning.md",{"path":69,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":70,"sourceHtmlUrl":71},"references\u002Funsupervised_learning.md",14440,"https:\u002F\u002Fgithub.com\u002FCarchaloneo22\u002FClaude-Code-template\u002Fblob\u002Fadd-x-twitter-scraper-skill\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fscientific\u002Fscikit-learn\u002Freferences\u002Funsupervised_learning.md",{"path":73,"resourceType":74,"resourceTypeDesc":75,"sizeBytes":76,"sourceHtmlUrl":77},"scripts\u002Fclassification_pipeline.py","SCRIPT","脚本",8044,"https:\u002F\u002Fgithub.com\u002FCarchaloneo22\u002FClaude-Code-template\u002Fblob\u002Fadd-x-twitter-scraper-skill\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fscientific\u002Fscikit-learn\u002Fscripts\u002Fclassification_pipeline.py",{"path":79,"resourceType":74,"resourceTypeDesc":75,"sizeBytes":80,"sourceHtmlUrl":81},"scripts\u002Fclustering_analysis.py",11396,"https:\u002F\u002Fgithub.com\u002FCarchaloneo22\u002FClaude-Code-template\u002Fblob\u002Fadd-x-twitter-scraper-skill\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fscientific\u002Fscikit-learn\u002Fscripts\u002Fclustering_analysis.py",[83,90,99,106,113,120],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":19},"01M7CPQFVGKX7H3Q5Y9CN0XAZN","zapier-make-patterns","No-code automation democratizes workflow building. Zapier and Make (formerly Integromat) let non-developers automate business processes without writing code. But no-code doesn't mean no-complexity - these platforms have their own patterns, pitfalls, and breaking points.  This skill covers when to use which platform, how to build reliable automations, and when to graduate to code-based solutions. Key insight: Zapier optimizes for simplicity and integrations (7000+ apps), Make optimizes for power","https:\u002F\u002Fgithub.com\u002FCarchaloneo22\u002FClaude-Code-template\u002Fblob\u002Fadd-x-twitter-scraper-skill\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fworkflow-automation\u002Fzapier-make-patterns\u002FSKILL.md",[],[],{"skillNo":91,"name":92,"nameZh":6,"description":93,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":94,"licenseFileUrl":95,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":19},"01M7CPQDR2HMKAYHAAY99EA4B2","yeet","Use only when the user explicitly asks to stage, commit, push, and open a GitHub pull request in one flow using the GitHub CLI (`gh`).","Apache-2.0","https:\u002F\u002Fgithub.com\u002FCarchaloneo22\u002FClaude-Code-template\u002Fblob\u002Fadd-x-twitter-scraper-skill\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fworkflow-automation\u002Fyeet\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FCarchaloneo22\u002FClaude-Code-template\u002Fblob\u002Fadd-x-twitter-scraper-skill\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fworkflow-automation\u002Fyeet\u002FSKILL.md",[],[],{"skillNo":100,"name":101,"nameZh":6,"description":102,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":105,"publishedAt":19},"01M7CPQ7K5MAQSXEB027HZFM2G","workflow-automation","Workflow automation is the infrastructure that makes AI agents reliable. Without durable execution, a network hiccup during a 10-step payment flow means lost money and angry customers. With it, workflows resume exactly where they left off.  This skill covers the platforms (n8n, Temporal, Inngest) and patterns (sequential, parallel, orchestrator-worker) that turn brittle scripts into production-grade automation.  Key insight: The platforms make different tradeoffs. n8n optimizes for accessibility","https:\u002F\u002Fgithub.com\u002FCarchaloneo22\u002FClaude-Code-template\u002Fblob\u002Fadd-x-twitter-scraper-skill\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fworkflow-automation\u002Fworkflow-automation\u002FSKILL.md",[],[],{"skillNo":107,"name":108,"nameZh":6,"description":109,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":110,"categories":111,"keywords":112,"publishedAt":19},"01M7CPQ34F18JHMEM8NHQS1N7K","trigger-dev","Trigger.dev expert for background jobs, AI workflows, and reliable async execution with excellent developer experience and TypeScript-first design. Use when: trigger.dev, trigger dev, background task, ai background job, long running task.","https:\u002F\u002Fgithub.com\u002FCarchaloneo22\u002FClaude-Code-template\u002Fblob\u002Fadd-x-twitter-scraper-skill\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fworkflow-automation\u002Ftrigger-dev\u002FSKILL.md",[],[],{"skillNo":114,"name":115,"nameZh":6,"description":116,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":117,"categories":118,"keywords":119,"publishedAt":19},"01M7CPPZSXXDB1SAWT5N63ACZT","planning-with-files","Transforms workflow to use Manus-style persistent markdown files for planning, progress tracking, and knowledge storage. Use when starting complex tasks, multi-step projects, research tasks, or when the user mentions planning, organizing work, tracking progress, or wants structured output.","https:\u002F\u002Fgithub.com\u002FCarchaloneo22\u002FClaude-Code-template\u002Fblob\u002Fadd-x-twitter-scraper-skill\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fworkflow-automation\u002Fplanning-with-files\u002FSKILL.md",[],[],{"skillNo":121,"name":122,"nameZh":6,"description":123,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":124,"categories":125,"keywords":126,"publishedAt":19},"01M7CPPTQSBVWSK0R10FJNMP0F","n8n-workflow-patterns","Proven workflow architectural patterns from real n8n workflows. Use when building new workflows, designing workflow structure, choosing workflow patterns, planning workflow architecture, or asking about webhook processing, HTTP API integration, database operations, AI agent workflows, or scheduled tasks.","https:\u002F\u002Fgithub.com\u002FCarchaloneo22\u002FClaude-Code-template\u002Fblob\u002Fadd-x-twitter-scraper-skill\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fworkflow-automation\u002Fn8n\u002Fn8n-workflow-patterns\u002FSKILL.md",[],[]]