scikit-learn
БесплатноЗапускает вложенные скриптыНе проверенML toolkit. Classification, regression, clustering, PCA, preprocessing, pipelines, GridSearch, cross-validation, RandomForest, SVM, for general machine…
от lifangda★ 43 звезды на GitHubОб этом скилле
Scikit-learn: Machine Learning in Python
Overview
Scikit-learn is Python's premier machine learning library, offering simple and efficient tools for predictive data analysis. Apply this skill for classification, regression, clustering, dimensionality reduction, model selection, preprocessing, and hyperparameter optimization.
When to Use This Skill
This skill should be used when:
- Building classification models (spam detection, image recognition, medical diagnosis)
- Creating regression models (price prediction, forecasting, trend analysis)
- Performing clustering analysis (customer segmentation, pattern discovery)
- Reducing dimensionality (PCA, t-SNE for visualization)
- Preprocessing data (scaling, encoding, imputation)
- Evaluating model performance (cross-validation, metrics)
- Tuning hyperparameters (grid search, random search)
- Creating machine learning pipelines
- Detecting anomalies or outliers
- Implementing ensemble methods
Core Machine Learning Workflow
Standard ML Pipeline
Follow this general workflow for supervised learning tasks:
Data Preparation
- Load and explore data
- Split into train/test sets
- Handle missing values
- Encode categorical features
- Scale/normalize features
Model Selection
- Start with baseline model
- Try more complex models
- Use domain knowledge to guide selection
Model Training
- Fit model on training data
- Use pipelines to prevent data leakage
- Apply cross-validation
Model Evaluation
- Evaluate on test set
- Use appropriate metrics
- Analyze errors
Model Optimization
- Tune hyperparameters
- Feature engineering
- Ensemble methods
Deployment
- Save model using joblib
- Create prediction pipeline
- Monitor performance
Classification Quick Start
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import classification_report
from sklearn.pipeline import Pipeline
# Create pipeline (prevents data leakage)
pipeline = Pipeline([
('scaler', StandardScaler()),
('classifier', RandomForestClassifier(n_estimators=100, random_state=42))
])
# Split data (use stratify for imbalanced classes)
X_train, X_test, y_train, y_test = train_test_split(
X, y, test_size=0.2, random_state=42, stratify=y
)
# Train
pipeline.fit(X_train, y_train)
# Evaluate
y_pred = pipeline.predict(X_test)
print(classification_report(y_test, y_pred))
# Cross-validation for robust evaluation
from sklearn.model_selection import cross_val_score
scores = cross_val_score(pipeline, X_train, y_train, cv=5)
print(f"CV Accuracy: {scores.mean():.3f} (+/- {scores.std():.3f})")
Regression Quick Start
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.ensemble import RandomForestRegressor
from sklearn.metrics import mean_squared_error, r2_score
from sklearn.pipeline import Pipeline
# Create pipeline
pipeline = Pipeline([
('scaler', StandardScaler()),
('regressor', RandomForestRegressor(n_estimators=100, random_state=42))
])
# Split data
X_train, X_test, y_train, y_test = train_test_split(
X, y, test_size=0.2, random_state=42
)
# Train
pipeline.fit(X_train, y_train)
# Evaluate
y_pred = pipeline.predict(X_test)
rmse = mean_squared_error(y_test, y_pred, squared=False)
r2 = r2_score(y_test, y_pred)
print(f"RMSE: {rmse:.3f}, R²: {r2:.3f}")
Algorithm Selection Guide
Classification Algorithms
Start with baseline: LogisticRegression
- Fast, interpretable, works well for linearly separable data
- Good for high-dimensional data (text classification)
General-purpose: RandomForestClassifier
- Handles non-linear relationships
- Robust to outliers
- Provides feature importance
- Good default choice
Best performance: HistGradientBoostingClassifier
- State-of-the-art for tabular data
- Fast on large datasets (>10K samples)
- Often wins Kaggle competitions
Special cases:
- Small datasets (<1K): SVC with RBF kernel
- Very large datasets (>100K): SGDClassifier or LinearSVC
- Interpretability critical: LogisticRegression or DecisionTreeClassifier
- Probabilistic predictions: GaussianNB or calibrated models
- Text classification: LogisticRegression with TfidfVectorizer
Regression Algorithms
Start with baseline: LinearRegression or Ridge
- Fast, interpretable
- Works well when relationships are linear
General-purpose: RandomForestRegressor
- Handles non-linear relationships
- Robust to outliers
- Good default choice
Best performance: HistGradientBoostingRegressor
- State-of-the-art for tabular data
- Fast on large datasets
Special cases:
- Regularization needed: Ridge (L2) or Lasso (L1 + feature selection)
- Very large datasets: SGDRegressor
- Outliers present: HuberRegressor
Установить scikit-learn в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл scikit-learn?
ML toolkit. Classification, regression, clustering, PCA, preprocessing, pipelines, GridSearch, cross-validation, RandomForest, SVM, for general machine learning workflows.
Как установить скилл scikit-learn?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл scikit-learn запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
patterns
Find patterns worth sharing from recent PRs and repo history, both repeats to fix and good practices worth spreading. Use when a champion wants to know what…
от Anthropiccopilot-cli-quickstart
Use this skill when someone wants to learn GitHub Copilot CLI from scratch. Offers interactive step-by-step tutorials with separate Developer and…
от GitHubvardoger-analyze
Use when the user asks to personalize the GitHub Copilot CLI assistant, adapt Copilot to their style, use vardoger, or analyze their Copilot CLI conversation…
от GitHubpolicy-lookup
Find and explain company policies in plain language. Trigger with "what's our PTO policy", "can I work remotely from another country", "how do expenses work"…
от Anthropic