LeoYeAI/agent-master-skills / skills/automl-skill
automl-skill
VerifiedAutoML 自动化机器学习技能 | 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.
| File | Kind | Size |
|---|---|---|
| README.md | markdown | 8.3 KB |
| SKILL.md | skill md | 17.4 KB |
| _meta.json | config | 278 B |
| evals/evals.json | config | 9.1 KB |
| references/anomaly.md | markdown | 3.3 KB |
| references/association_rules.md | markdown | 2.7 KB |
| references/classification.md | markdown | 8.7 KB |
| references/clustering.md | markdown | 4.2 KB |
| references/nlp.md | markdown | 3.7 KB |
| references/regression.md | markdown | 5.2 KB |
| references/setup_parameters_deep_dive.md | markdown | 12.8 KB |
| references/time_series.md | markdown | 5.0 KB |
| references/utilities.md | markdown | 4.6 KB |
references/nlp.md
View on GitHub# PyCaret NLP 模块 | NLP Module
自然语言处理任务的完整 API 参考文档。
## setup() 函数
```python
from pycaret.nlp import setup
# 基础用法
nlp = setup(data, target='text_column')
# 完整参数
nlp = setup(
# ===== 必需参数 =====
data, # 数据框(必需)
target, # 文本列名(必需)
# ===== 特征指定 =====
numeric_features=None, # 数值特征
categorical_features=None, # 类别特征
ignore_features=None, # 忽略的特征
# ===== 数据预处理 =====
imputation_type='simple', # 插补类型
max_encoding_ohe=25, # OHE 编码数
encoding_method=None, # 编码方法
# ===== 文本处理 =====
text_features_method='tf-idf', # 文本特征方法: 'tf-idf', 'bow', 'embeddings'
text_aggregation='sum', # 聚合方式: 'sum', 'mean', 'median', 'max', 'min'
text_feature_extract=None, # 特征提取: None, 'tokenize'
# ===== 降维 =====
pca=False,
pca_method='linear',
pca_components=None,
# ===== 聚类配置 =====
clustering=False, # 是否进行聚类
cluster_method='kmeans', # 聚类方法
# ===== 主题模型 =====
topic_model=None, # 主题模型配置
topic_model_name='lda', # 模型名: 'lda', 'nmf', 'lsi', 'hdp'
num_topics='auto', # 主题数量
# ===== 系统选项 =====
n_jobs=-1,
html=True,
session_id=None,
log_experiment=False,
experiment_name=None,
verbose=True,
profile=False
)
```
## 常用主题模型
```python
'lda' # Latent Dirichlet Allocation
'nmf' # Non-Negative Matrix Factorization
'lsi' # Latent Semantic Indexing
'hdp' # Hierarchical Dirichlet Process
```
## create_model()
```python
from pycaret.nlp import create_model
# 创建主题模型
lda = create_model('lda', num_topics=4)
# 带参数
lda = create_model('lda', num_topics=4, doc_topic_prior=0.1, topic_word_prior=0.01)
nmf = create_model('nmf', num_topics=4)
```
## tune_model()
```python
from pycaret.nlp import tune_model
# 调优
tuned = tune_model(lda)
```
## assign_model()
```python
from pycaret.nlp import assign_model
# 分配主题
results = assign_model(lda)
# 返回原始数据 + Topic 相关列
```
## plot_model() 图表类型
| 图表 | 说明 |
|------|------|
| `'wordcloud'` | 词云 |
| `'frequency'` | 词频图 |
| `'ngram'` | N-gram 图 |
| `'sentiment'` | 情感分布 |
| `'dimension'` | 维度分布 |
| `'topic_distribution'` | 主题分布 |
| `'topic_model'` | 主题模型可视化 |
## evaluate_model()
```python
from pycaret.nlp import evaluate_model
evaluate_model(lda)
```
## predict_model()
```python
from pycaret.nlp import predict_model
# 预测新文本
predictions = predict_model(lda, data=new_texts)
```
## 完整工作流示例
```python
from pycaret.nlp import *
# 1. 加载数据
data = get_data('kiva')
# 2. 初始化
nlp = setup(data, target='loan_theme')
# 3. 创建主题模型
lda = create_model('lda', num_topics=4)
# 4. 调优
tuned = tune_model(lda)
# 5. 分配主题
results = assign_model(tuned)
# 6. 可视化
plot_model(tuned, plot='wordcloud')
plot_model(tuned, plot='frequency')
plot_model(tuned, plot='topic_distribution')
# 7. 评估
evaluate_model(tuned)
```
## 文本分类
```python
# 使用 pycaret.text 进行文本分类
from pycaret.text import *
clf = setup(data, target='target_column')
best = compare_models()
```
## 情感分析
```python
# 情感分析
sentiment = create_model('sentiment')
results = assign_model(sentiment)
```
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the work | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixes | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation code | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| 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: 198k | Updated | Claude CodeCodex | Verified | Install |