Chuyển đến nội dung
Skillpedia
Học máy51k · #3568

scikit-learn

Skill này làm gì

Công cụ này giúp bạn xây dựng mô hình học máy bằng Python. Nó hữu ích để dự đoán kết quả, nhóm các dữ liệu giống nhau hoặc đơn giản hóa thông tin phức tạp.

Khi nào nên dùng

  • ✓Khi bạn muốn dự đoán liệu một khách hàng có mua sản phẩm hay không.
  • ✓Khi bạn muốn nhóm khách hàng theo thói quen mua sắm.
  • ✓Khi bạn muốn chuẩn bị dữ liệu để mô hình AI có thể sử dụng.

Liên kết skill

https://github.com/K-Dense-AI/scientific-agent-skills/blob/main/skills/scikit-learn/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/K-Dense-AI/scientific-agent-skills/blob/main/skills/scikit-learn/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Làm thế nào để dùng scikit-learn dự đoán những khách hàng nào sẽ rời bỏ dịch vụ?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Công cụ dùng các thuật toán học máy để tìm quy luật trong dữ liệu. Bạn cung cấp dữ liệu mẫu, và nó học cách đưa ra dự đoán hoặc tìm sự tương đồng.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

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. 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.

# 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:

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

from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import classification_report

# Split data
X_train, X_test, y_train, y_test = train_test_split(
    X, y, test_size=0.2, stratify=y, random_state=42
)

# Preprocess
scaler = StandardScaler()
X_train_scaled = scaler.fit_transform(X_train)
X_test_scaled = scaler.transform(X_test)

# Train model
model = RandomForestClassifier(n_estimators=100, random_state=42)
model.fit(X_train_scaled, y_train)

# Evaluate
y_pred = model.predict(X_test_scaled)
print(classification_report(y_test, y_pred))

Complete Pipeline with Mixed Data

from sklearn.pipeline import Pipeline
from sklearn.compose import ColumnTransformer
from sklearn.preprocessing import StandardScaler, OneHotEncoder
from sklearn.impute import SimpleImputer
from sklearn.ensemble import GradientBoostingClassifier

# Define feature types
numeric_features = ['age', 'income']
categorical_features = ['gender', 'occupation']

# Create preprocessing pipelines
numeric_transformer = Pipeline([
    ('imputer', SimpleImputer(strategy='median')),
    ('scaler', StandardScaler())
])

categorical_transformer = Pipeline([
    ('imputer', SimpleImputer(strategy='most_frequent')),
    ('onehot', OneHotEncoder(handle_unknown='ignore'))
])

# Combine transformers
preprocessor = ColumnTransformer([
    ('num', numeric_transformer, numeric_features),
    ('cat', categorical_transformer, categorical_features)
])

# Full pipeline
model = Pipeline([
    ('preprocessor', preprocessor),
    ('classifier', GradientBoostingClassifier(random_state=42))
])

# Fit and predict
model.fit(X_train, y_train)
y_pred = model.predict(X_test)

Core Capabilities

Five capability areas are documented in references/core_capabilities.md, with per-topic detail in references/supervised_learning.md, references/unsupervised_learning.md, references/model_evaluation.md, references/preprocessing.md, and references/pipelines_and_composition.md:

  1. Supervised learning — classification and regression estimator families.
  2. Unsupervised learning — clustering, decomposition, and manifold learning.
  3. Model evaluation and selection — metrics, cross-validation, and hyperparameter search.
  4. Data preprocessing — scaling, encoding, imputation, and feature selection.

…

Câu hỏi thường gặp

Tôi có cần cài đặt gì không?

Có, bạn cần cài thư viện “scikit-learn” trong môi trường Python. Tài liệu hướng dẫn cách làm bằng lệnh “uv pip install scikit-learn”.

“Classification” và “regression” là gì?

“Classification” (phân loại) là dự đoán một nhóm (ví dụ “có” hoặc “không”). “Regression” (hồi quy) là dự đoán một con số (ví dụ giá của một căn nhà).

“Preprocessing” là gì?

Đó là bước sắp xếp và làm sạch dữ liệu trước khi dùng để huấn luyện mô hình AI. Bao gồm việc chuẩn hóa số hoặc chuyển văn bản thành dạng mô hình có thể hiểu.

Chi tiết

Mô tả gốc của tác giả

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.

repo: K-Dense-AI/scientific-agent-skills

Độ phổ biến

Sao GitHub
51k
Vị trí xếp hạng
#3568
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự