Skip to content

LeoYeAI/agent-master-skills / skills/automl-skill

automl-skill

Verified

AutoML 自动化机器学习技能 | Automated Machine Learning Skill. 基于 PyCaret 进行低代码机器学习建模,支持分类、回归、聚类、异常检测、时间序列预测、自然语言处理和关联规则挖掘等任务。 未来将集成更多 AutoML 库(如 AutoGluon、FLAML 等)。 当用户需要快速构建机器学习模型、自动化模型选择、超参数调优、模型集成、特征工程或进行 AutoML 实验时使用此技能。 适用于数据科学家、公民数据科学家、机器学习工程师和希望快速原型开发的人员。 触发关键词:AutoML、机器学习自动化、PyCaret、分类模型、回归模型、聚类、异常检测、时间序列、文本分类、模型调优、模型比较、特征选择、统计检验、显著性检验、A/B测试。 Trigger keywords in English: AutoML, automated machine learning, PyCaret, classification, regression, clustering, anomaly detection, time series forecasting, NLP, text mining, model tuning, model comparison, feature engineering, statistical test, significance testing, A/B testing.

FileKindSize
README.mdmarkdown8.3 KB
SKILL.mdskill md17.4 KB
_meta.jsonconfig278 B
evals/evals.jsonconfig9.1 KB
references/anomaly.mdmarkdown3.3 KB
references/association_rules.mdmarkdown2.7 KB
references/classification.mdmarkdown8.7 KB
references/clustering.mdmarkdown4.2 KB
references/nlp.mdmarkdown3.7 KB
references/regression.mdmarkdown5.2 KB
references/setup_parameters_deep_dive.mdmarkdown12.8 KB
references/time_series.mdmarkdown5.0 KB
references/utilities.mdmarkdown4.6 KB

references/anomaly.md

View on GitHub
# PyCaret Anomaly 模块 | Anomaly Detection Module

异常检测任务的完整 API 参考文档。

## setup() 函数

```python
from pycaret.anomaly import setup

# 基础用法
ano = setup(data)

# 参数与 Clustering 模块基本相同
ano = setup(
    data,
    index=True,
    numeric_features=None,
    categorical_features=None,
    ordinal_features=None,
    date_features=None,
    text_features=None,
    ignore_features=None,
    keep_features=None,
    preprocess=True,
    imputation_type='simple',
    numeric_imputation='mean',
    categorical_imputation='constant',
    text_features_method='tf-idf',
    max_encoding_ohe=-1,
    encoding_method=None,
    rare_to_value=None,
    rare_value='rare',
    polynomial_features=False,
    polynomial_degree=2,
    low_variance_threshold=None,
    remove_multicollinearity=False,
    multicollinearity_threshold=0.9,
    bin_numeric_features=None,
    remove_outliers=False,
    outliers_method='iforest',
    outliers_threshold=0.05,
    transformation=False,
    transformation_method='yeo-johnson',
    normalize=False,
    normalize_method='zscore',
    pca=False,
    pca_method='linear',
    pca_components=None,
    custom_pipeline=None,
    custom_pipeline_position=-1,
    n_jobs=-1,
    use_gpu=False,
    html=True,
    session_id=None,
    log_experiment=False,
    experiment_name=None,
    experiment_custom_tags=None,
    log_plots=False,
    log_profile=False,
    log_data=False,
    verbose=True,
    memory=True,
    profile=False,
    profile_kwargs={}
)
```

## 常用异常检测算法

```python
'iforest'   # Isolation Forest
'ee'        # Elliptic Envelope
'lof'       # Local Outlier Factor
'svm'       # One-Class SVM
'pca'       # PCA-based Outlier Detection
'kde'       # Kernel Density Estimation
```

## create_model()

```python
from pycaret.anomaly import create_model

# Isolation Forest
iforest = create_model('iforest')

# Elliptic Envelope
ee = create_model('ee')

# Local Outlier Factor
lof = create_model('lof')

# One-Class SVM
svm = create_model('svm')

# 带参数
iforest = create_model('iforest', contamination=0.1, random_state=42)
```

## tune_model()

```python
from pycaret.anomaly import tune_model

# 调优
tuned = tune_model('iforest')
```

## assign_model()

```python
from pycaret.anomaly import assign_model

# 分配异常标签
results = assign_model(model)
# 返回原始数据 + Cluster 列 (1=正常, -1=异常)
```

## plot_model() 图表类型

| 图表 | 说明 |
|------|------|
| `'tsne'` | t-SNE 可视化 |
| `'umap'` | UMAP 可视化 |
| `'cluster'` | Cluster PCA Plot |

## evaluate_model()

```python
from pycaret.anomaly import evaluate_model

evaluate_model(model)
```

## predict_model()

```python
from pycaret.anomaly import predict_model

# 预测新数据
predictions = predict_model(model, data=new_data)
# 返回 Label (1=正常, -1=异常) 和 Score
```

## 完整工作流示例

```python
from pycaret.anomaly import *

# 1. 加载数据
data = get_data('outlier')

# 2. 初始化
ano = setup(data, normalize=True)

# 3. 创建模型
iforest = create_model('iforest', contamination=0.05)

# 4. 调优
tuned = tune_model(iforest)

# 5. 分配标签
results = assign_model(tuned)

# 6. 可视化
plot_model(tuned, plot='tsne')

# 7. 评估
evaluate_model(tuned)

# 8. 预测新数据
predictions = predict_model(tuned, data=new_data)
```
finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the workStars: 322kUpdated Claude CodeCodexVerifiedInstall
systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixesStars: 322kUpdated Claude CodeCodexVerifiedInstall
test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation codeStars: 322kUpdated Claude CodeCodexVerifiedInstall
skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.Stars: 198kUpdated Claude CodeCodexVerifiedInstall