Habilidades scikit-learn
🔬

scikit-learn

Seguro ⚡ Contém scripts⚙️ Comandos externos

应用 scikit-learn 构建机器学习模型

Também disponível em: K-Dense-AI

通过 scikit-learn 指导快速构建机器学习模型。涵盖分类、回归、聚类、预处理、管道和模型评估,提供可直接使用的示例。

Suporta: Claude Codex Code(CC)
🥉 76 Bronze
1

Baixar o ZIP da skill

2

Upload no Claude

Vá em Configurações → Capacidades → Skills → Upload skill

3

Ative e comece a usar

Testar

A utilizar "scikit-learn". Build a classification model to predict customer churn

Resultado esperado:

  • Model: RandomForestClassifier with 100 estimators
  • Preprocessing: StandardScaler for numeric features, OneHotEncoder for categorical
  • Cross-validation accuracy: 94.2% (+/- 1.3%)
  • Top predictive features: contract_type, monthly_charges, tenure
  • Recommendations: Consider GradientBoosting for higher accuracy, collect more features about customer complaints

Auditoria de Segurança

Seguro
v5 • 1/17/2026

All 566 static findings are FALSE POSITIVES. The static analyzer misidentified markdown documentation syntax (backticks for code formatting) as shell commands, Python import examples as dynamic imports, and 'PC2' (Principal Component 2) as C2 command-and-control keywords. This is a pure documentation/reference skill containing legitimate scikit-learn ML examples with no network calls, credential access, or file exfiltration capabilities.

10
Arquivos analisados
4,543
Linhas analisadas
2
achados
5
Total de auditorias
Auditado por: claude Ver Histórico de Auditoria →

Pontuação de qualidade

68
Arquitetura
100
Manutenibilidade
83
Conteúdo
21
Comunidade
100
Segurança
87
Conformidade com especificações

O Que Você Pode Construir

构建生产级机器学习管道

创建端到端的机器学习工作流,包括预处理、模型训练、评估和超参数调优。

比较机器学习算法

使用标准化指标和交叉验证评估不同的分类器、回归器和聚类方法。

应用无监督学习

使用聚类、降维和异常检测技术发现数据中的模式。

Tente Estes Prompts

快速分类
使用 scikit-learn 构建分类模型。使用 breast cancer 数据集。使用 train-test split、StandardScaler 预处理、RandomForest 分类器,并显示 classification report。
聚类分析
使用 scikit-learn 对 iris 数据集进行聚类分析。比较 K-Means、DBSCAN 和 AgglomerativeClustering。使用 elbow method 和 silhouette score 找到最佳聚类数。使用 PCA 可视化结果。
机器学习管道
创建完整的机器学习管道,使用 ColumnTransformer 处理混合的数值和分类数据。包括预处理(插补、缩放、编码)、用于降维的 PCA 和 GradientBoosting 分类器。使用 GridSearchCV 进行超参数调优。
模型评估
使用交叉验证评估分类模型。显示 accuracy、precision、recall、F1-score 和 ROC AUC。创建 confusion matrix 和 learning curves。使用 stratified k-fold 比较不平衡类别。

Melhores Práticas

  • 始终使用管道来防止交叉验证中的数据泄露
  • 在使用需要归一化输入的算法(SVM、KNN、神经网络)之前缩放特征
  • 对于分类使用分层分割以保持类别分布

Evitar

  • 在分割之前对所有数据进行预处理(导致数据泄露)
  • 对不平衡的分类问题仅使用准确率
  • 不为实验设置 random_state 以确保可重复性

Perguntas Frequentes

对于分类我应该从哪个算法开始?
从 LogisticRegression 作为快速基线开始,然后尝试 RandomForest 作为稳健的默认选择。当准确性至关重要且可以花时间调优超参数时,使用 GradientBoosting。
所有算法都需要缩放特征吗?
不需要。基于树的模型(Random Forest、决策树)不需要缩放。需要缩放的场景包括:SVM、KNN、神经网络、PCA 和带正则化的线性模型。
如何处理混合的数值和分类特征?
使用 ColumnTransformer 对不同列应用不同的预处理。使用 StandardScaler 缩放数值特征,使用 OneHotEncoder 对分类特征进行编码。
使用这些脚本时我的数据安全吗?
是的。脚本使用 scikit-learn API 在本地运行。它们只读取您提供的数据,在内存中处理数据,并将可选的可视化结果保存到当前目录。
为什么我的模型不收敛?
增加 max_iter 参数或缩放您的特征。对于线性模型,尝试使用 StandardScaler 进行缩放。对于深度树,考虑限制 max_depth 或增加 min_samples_leaf。
这与 TensorFlow 或 PyTorch 相比如何?
scikit-learn 在处理结构化数据的传统机器学习方面表现出色。对于图像、文本或复杂神经架构的深度学习,请使用 TensorFlow 或 PyTorch。scikit-learn 在传统任务中提供更好的可解释性和更快的迭代。