Complete scikit-learn 1.8 toolkit for machine learning covering supervised and unsupervised algorithms, pipelines, preprocessing, model selection, metrics, and datasets. Use when building ML models in Python, performing classification/regression/clustering, feature engineering, hyperparameter tuning, or evaluating model performance with scikit-learn 1.8+.
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Um comando direto ignora o prompt de revisão. Verifique a origem antes de executá-lo.
Instruções da origem · Visualização somente leitura
name
scikit-learn-1-8-0
description
Complete scikit-learn 1.8 toolkit for machine learning covering supervised and unsupervised algorithms, pipelines, preprocessing, model selection, metrics, and datasets. Use when building ML models in Python, performing classification/regression/clustering, feature engineering, hyperparameter tuning, or evaluating model performance with scikit-learn 1.8+.
scikit-learn 1.8.0
Overview
Scikit-learn is the most widely used open-source machine learning library for Python. It provides simple and efficient tools for predictive data analysis, accessible to everybody and reusable in various contexts. Built on NumPy, SciPy, and matplotlib, it is released under the BSD license.
Version 1.8.0 (December 2025) brings free-threaded CPython 3.14 support, major manifold learning improvements with ClassicalMDS and enhanced MDS/TSNE, temperature scaling for probability calibration, significant efficiency gains in linear models via gap safe screening rules, expanded Array API support across 20+ estimators and functions, and numerous bug fixes across the entire codebase.
When to Use
Building supervised ML models (classification, regression) with algorithms like SVMs, random forests, gradient boosting, or logistic regression
Unsupervised learning tasks: clustering (KMeans, DBSCAN, HDBSCAN), dimensionality reduction (PCA, MDS, t-SNE), or density estimation
Building reproducible ML pipelines that chain preprocessing and modeling steps
Working with built-in datasets (iris, digits, wine) or generated data
Core Concepts
Estimators
Every machine learning algorithm in scikit-learn is an estimator. All estimators share a common API:
fit(X, y) — train the model on data. For unsupervised learning, call fit(X) without y.
predict(X) — predict target values for new data (supervised estimators only).
predict_proba(X) — predict class probabilities (classifiers that support it).
score(X, y) — return evaluation score (accuracy for classifiers, R² for regressors).
from sklearn.ensemble import RandomForestClassifier
from sklearn.datasets import load_iris
X, y = load_iris(return_X_y=True)
clf = RandomForestClassifier(random_state=0)
clf.fit(X, y)
predictions = clf.predict(X)
accuracy = clf.score(X, y) # 1.0 for training data
Transformers
Transformers preprocess data and follow the same API plus a transform method:
fit(X) — learn parameters from data (e.g., mean/std for StandardScaler).
transform(X) — apply transformation using learned parameters.
fit_transform(X) — fit then transform in one step (often more efficient).
from sklearn.preprocessing import StandardScaler
scaler = StandardScaler()
X_scaled = scaler.fit_transform(X)
Pipelines
Pipelines chain transformers and a final estimator into a single object, preventing data leakage:
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LogisticRegression
pipe = make_pipeline(StandardScaler(), LogisticRegression())
pipe.fit(X_train, y_train)
predictions = pipe.predict(X_test)
Model Selection
Cross-validation and hyperparameter tuning are central to scikit-learn:
cross_val_score — quick evaluation across multiple splits.
GridSearchCV — exhaustive search over a parameter grid.
RandomizedSearchCV — random sampling from parameter distributions.
Preprocessing and Feature Engineering: Scaling, encoding, imputation, polynomial/spline features, feature selection, missing value handling → Preprocessing and Features
Model Selection and Evaluation: Cross-validation strategies, hyperparameter tuning, metrics (classification, regression, clustering), scoring functions → Model Selection and Metrics
Pipelines and Compositors: Pipeline API, ColumnTransformer, FeatureUnion, FrozenEstimator, metadata routing → Pipelines and Compositors
Version 1.8 Highlights: Free-threaded CPython 3.14 support, ClassicalMDS, temperature scaling, gap safe screening in linear models, Array API expansion, API changes and deprecations → Version 1.8 New Features