码迷,mamicode.com
首页 > 其他好文 > 详细

pycaret模型分析之绘制模型结果

时间:2020-10-13 17:03:38      阅读:22      评论:0      收藏:0      [点我收藏+]

标签:sel   report   ima   kmeans   规则   mode   语言   cal   学习   

分析训练完成的机器学习模型的性能是任何机器学习工作流程中必不可少的步骤。 在PyCaret中分析模型性能就像编写plot_model一样简单。 该函数将受训的模型对象和图的类型作为plot_model函数中的字符串。

分类:

Name Plot
Area Under the Curve ‘auc’
Discrimination Threshold ‘threshold’
Precision Recall Curve ‘pr’
Confusion Matrix ‘confusion_matrix’
Class Prediction Error ‘error’
Classification Report ‘class_report’
Decision Boundary ‘boundary’
Recursive Feature Selection ‘rfe’
Learning Curve ‘learning’
Manifold Learning ‘manifold’
Calibration Curve ‘calibration’
Validation Curve ‘vc’
Dimension Learning ‘dimension’
Feature Importance ‘feature’
Model Hyperparameter ‘parameter’

例子:

# Importing dataset
from pycaret.datasets import get_data
diabetes = get_data(diabetes)

# Importing module and initializing setup
from pycaret.classification import *
clf1 = setup(data = diabetes, target = Class variable)

# creating a model
lr = create_model(lr)

# plotting a model
plot_model(lr)

技术图片

回归:

Name Plot
Residuals Plot ‘residuals’
Prediction Error Plot ‘error’
Cooks Distance Plot ‘cooks’
Recursive Feature Selection ‘rfe’
Learning Curve ‘learning’
Validation Curve ‘vc’
Manifold Learning ‘manifold’
Feature Importance ‘feature’
Model Hyperparameter ‘parameter’

例子:

# Importing dataset
from pycaret.datasets import get_data
boston = get_data(boston)

# Importing module and initializing setup
from pycaret.regression import *
reg1 = setup(data = boston, target = medv)

# creating a model
lr = create_model(lr)

# plotting a model
plot_model(lr)

技术图片

聚类:

Name Plot
Cluster PCA Plot (2d) ‘cluster’
Cluster TSnE (3d) ‘tsne’
Elbow Plot ‘elbow’
Silhouette Plot ‘silhouette’
Distance Plot ‘distance’
Distribution Plot ‘distribution’

例子:

# Importing dataset
from pycaret.datasets import get_data
jewellery = get_data(jewellery)

# Importing module and initializing setup
from pycaret.clustering import *
clu1 = setup(data = jewellery)

# creating a model
kmeans = create_model(kmeans)

# plotting a model
plot_model(kmeans)

技术图片

异常检测:

Name Plot
t-SNE (3d) Dimension Plot ‘tsne’
UMAP Dimensionality Plot ‘umap’

例子:

# Importing dataset
from pycaret.datasets import get_data
anomalies = get_data(anomaly)

# Importing module and initializing setup
from pycaret.anomaly import *
ano1 = setup(data = anomalies)

# creating a model
iforest = create_model(iforest)

# plotting a model
plot_model(iforest)

技术图片

自然语言处理:

Name Plot
Word Token Frequency ‘frequency’
Word Distribution Plot ‘distribution’
Bigram Frequency Plot ‘bigram’
Trigram Frequency Plot ‘trigram’
Sentiment Polarity Plot ‘sentiment’
Part of Speech Frequency ‘pos’
t-SNE (3d) Dimension Plot ‘tsne’
Topic Model (pyLDAvis) ‘topic_model’
Topic Infer Distribution ‘topic_distribution’
Word cloud ‘wordcloud’
UMAP Dimensionality Plot ‘umap’

例子:

# Importing dataset
from pycaret.datasets import get_data
kiva = get_data(kiva)

# Importing module and initializing setup
from pycaret.nlp import *
nlp1 = setup(data = kiva, target = en)

# creating a model
lda = create_model(lda)

# plotting a model
plot_model(lda)

技术图片

关联规则挖掘:

Plot Abbrev. String
Support, Confidence and Lift (2d) ‘frequency’
Support, Confidence and Lift (3d) ‘distribution’

例子:

# Importing dataset
from pycaret.datasets import get_data
france = get_data(france)

# Importing module and initializing setup
from pycaret.arules import *
arul1 = setup(data = france, transaction_id = Invoice, item_id = Description)

# creating a model
model = create_model(metric = confidence)

# plotting a model
plot_model(model)

技术图片

 

pycaret模型分析之绘制模型结果

标签:sel   report   ima   kmeans   规则   mode   语言   cal   学习   

原文地址:https://www.cnblogs.com/xiximayou/p/13799181.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!