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/association_rules.md

View on GitHub
# PyCaret Association Rules 模块 | Association Rules Module

关联规则挖掘任务的完整 API 参考文档。

## setup() 函数

```python
from pycaret.arules import setup

# 基础用法
arules = setup(data, transaction_id='transaction_id', item_features='item')

# 完整参数
arules = setup(
    # ===== 必需参数 =====
    data,                                 # 数据框(必需)
    transaction_id,                      # 交易ID列(必需)
    item_features=None,                  # 商品特征列
    
    # ===== 数据处理 =====
    encoding_method=None,                # 编码方法
    freq_threshold=0.01,                # 频繁项集阈值
    
    # ===== 系统选项 =====
    n_jobs=-1,
    html=True,
    session_id=None,
    verbose=True,
    profile=False
)
```

## create_model()

```python
from pycaret.arules import create_model

# 创建关联规则模型
model = create_model()

# 完整参数
model = create_model(
    metric='confidence',                # 评估指标
    threshold=0.5,                      # 阈值
    min_support=0.001,                 # 最小支持度
    max_length=10                       # 最大项集长度
)
```

## 评估指标

| 指标 | 说明 |
|------|------|
| support | 支持度 |
| confidence | 置信度 |
| lift | 提升度 |

## assign_model()

```python
from pycaret.arules import assign_model

# 获取关联规则
rules = assign_model(model)
# 返回关联规则表
```

## plot_model() 图表类型

| 图表 | 说明 |
|------|------|
| `'network'` | 关联网络图 |
| `'matrix'` | 关联矩阵图 |
| `'sunburst'` | 旭日图 |

## 完整工作流示例

```python
from pycaret.arules import *

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

# 2. 初始化
arules = setup(data, transaction_id='Item', item_features='Amount')

# 3. 创建模型
model = create_model(
    metric='confidence',
    threshold=0.5,
    min_support=0.01
)

# 4. 获取规则
rules = assign_model(model)

# 5. 可视化
plot_model(model, plot='network')
plot_model(model, plot='matrix')

# 6. 查看规则
print(rules.head(10))
```

## 常用参数说明

- **metric**: 评估指标,可选 'support', 'confidence', 'lift'
- **threshold**: 阈值,过滤低于此值的规则
- **min_support**: 最小支持度
- **max_length**: 项集最大长度

## 示例数据格式

交易数据格式示例:

| transaction_id | item |
|----------------|------|
| 1 | Apple |
| 1 | Banana |
| 1 | Milk |
| 2 | Banana |
| 2 | Bread |
| 3 | Apple |
| 3 | Bread |
| 3 | Milk |
| 3 | Banana |

或使用 One-Hot 编码格式:

| transaction_id | Apple | Banana | Bread | Milk |
|----------------|-------|--------|-------|------|
| 1 | 1 | 1 | 0 | 1 |
| 2 | 0 | 1 | 1 | 0 |
| 3 | 1 | 1 | 1 | 1 |
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