当前位置: 首页 > news >正文

台州网站建设惠店软件定制开发公司

台州网站建设惠店,软件定制开发公司,惠州seo外包服务,微博推广费用一般多少scikit-plot是基于sklearn和Matplotlib的库,主要的功能是对训练好的模型进行可视化。 安装: pip install scikit-plot 功能1:评估指标可视化 scikitplot.metrics.plot_confusion_matrix快速展示模型预测结果和标签计算得到的混淆矩阵。 im…

scikit-plot是基于sklearn和Matplotlib的库,主要的功能是对训练好的模型进行可视化。

安装:

pip install scikit-plot

功能1:评估指标可视化

scikitplot.metrics.plot_confusion_matrix快速展示模型预测结果和标签计算得到的混淆矩阵。

import scikitplot as skpltrf = RandomForestClassifier()rf = rf.fit(X_train, y_train)y_pred = rf.predict(X_test)skplt.metrics.plot_confusion_matrix(y_test, y_pred, normalize=True)plt.show()


scikitplot.metrics.plot_roc快速展示模型预测的每个类别的ROC曲线。

 

 

import scikitplot as skplt
nb = GaussianNB()
nb = nb.fit(X_train, y_train)
y_probas = nb.predict_proba(X_test)skplt.metrics.plot_roc(y_test, y_probas)
plt.show()

scikitplot.metrics.plot_precision_recall从标签和概率生成PR曲线

 

import scikitplot as skplt
nb = GaussianNB()
nb.fit(X_train, y_train)
y_probas = nb.predict_proba(X_test)skplt.metrics.plot_precision_recall(y_test, y_probas)
plt.show()

scikitplot.metrics.plot_calibration_curve绘制分类器的矫正曲线

 

import scikitplot as skplt
rf = RandomForestClassifier()
lr = LogisticRegression()
nb = GaussianNB()
svm = LinearSVC()
rf_probas = rf.fit(X_train, y_train).predict_proba(X_test)
lr_probas = lr.fit(X_train, y_train).predict_proba(X_test)
nb_probas = nb.fit(X_train, y_train).predict_proba(X_test)
svm_scores = svm.fit(X_train, y_train).decision_function(X_test)
probas_list = [rf_probas, lr_probas, nb_probas, svm_scores]
clf_names = ['Random Forest', 'Logistic Regression','Gaussian Naive Bayes', 'Support Vector Machine']skplt.metrics.plot_calibration_curve(y_test,probas_list,clf_names)
plt.show()

功能2:模型可视化

scikitplot.estimators.plot_learning_curve生成不同训练样本下的训练和测试学习曲线图

import scikitplot as skplt
rf = RandomForestClassifier()skplt.estimators.plot_learning_curve(rf, X, y)
plt.show()

 scikitplot.estimators.plot_feature_importances可视化特征重要性。

 

import scikitplot as skplt
rf = RandomForestClassifier()
rf.fit(X, y)skplt.estimators.plot_feature_importances(rf, feature_names=['petal length', 'petal width','sepal length', 'sepal width'])
plt.show()

功能3:聚类可视化

  • scikitplot.cluster.plot_elbow_curve展示聚类的肘步图。

 

import scikitplot as skplt
kmeans = KMeans(random_state=1)skplt.cluster.plot_elbow_curve(kmeans, cluster_ranges=range(1, 30))
plt.show()

功能4:降维可视化

  • scikitplot.decomposition.plot_pca_component_variance绘制 PCA 分量的解释方差比。
import scikitplot as skplt
pca = PCA(random_state=1)
pca.fit(X)skplt.decomposition.plot_pca_component_variance(pca)plt.show()

 scikitplot.decomposition.plot_pca_2d_projection绘制PCA降维之后的散点图。

import scikitplot as skplt
pca = PCA(random_state=1)
pca.fit(X)skplt.decomposition.plot_pca_2d_projection(pca, X, y)
plt.show()

 principle components(主成分)是通过线性变换从原始数据中提取出来的新变量。主成分是原始数据的线性组合,通过这种方式,它们能够捕捉到数据中的最大方差。

PCA的目标是将高维数据转换为一组低维的主成分,这些主成分将数据中的方差解释得尽可能好。第一个主成分解释了最大的方差,第二个主成分解释了次大的方差,以此类推。每个主成分都是关于原始特征的线性组合,并且它们之间是正交的(相互之间不相关)。

主成分类似于原始数据的投影,但是它们的排序是如此安排,以便第一个主成分解释了最大的方差,第二个主成分解释了次大的方差,以此类推。这允许我们选择在最小信息损失的情况下保留具有最高方差的主要特征,并减少数据的维度。

http://www.yidumall.com/news/31032.html

相关文章:

  • 惠阳做网站制作网站的步骤和过程
  • 网站建设教程视频整合营销传播方法包括
  • 做缓网站建立网站的详细步骤
  • 衡水网站建设培训学校关键词权重查询
  • 小公司做网站还是微博seo网络推广软件
  • 上海高端网站开发公司seo裤子的关键词首页排名有哪些
  • 电商网站建设运城百度seo点击
  • 做企业网站建设站点搜索
  • 织梦后台怎么加自己做的网站英文seo推广
  • 石家庄市住房城乡建设局网站百度信息流推广教程
  • 连衣裙一起做网站移动网站如何优化排名
  • 网站是陕西省城乡建设综合服务中心东莞整站优化排名
  • wordpress 阿里 ecs专业的网站优化公司
  • wordpress代码运行插件王通seo赚钱培训
  • 中学生免费作文网站如何做平台推广
  • 武汉做网站公司生产厂家深圳网络营销技巧
  • 伴奏网站防盗是怎么做的福州今日头条新闻
  • 宁波招聘网站开发链接搜索
  • 江门网站建设自助建站各种网站
  • 个人外贸网站网络优化app哪个好
  • 网站后台怎么挂广告 怎么做宣传推广方式
  • 沧州网站建设icp备互联网营销模式有哪些
  • 移动互联网开发官网seo软件简单易排名稳定
  • 专业建站公司提供详细的功能描述及报价百度seo优化服务项目
  • 猎头自己在哪个网站做单无锡营销型网站建站
  • 最好的网站建设报价最新的疫情情况
  • 建设工程安全备案网站新品怎么刷关键词
  • 论坛是做网站还是app好互联网推广是做什么的
  • 东莞网站建设免费服务器精准营销策略都有哪些
  • 建设外国商城网站企业网站设计优化公司