![](https://csdnimg.cn/release/download_crawler_static/86316157/bg1.jpg)
https://mp.weixin.qq.com/s/x0b39e9Pfuqk1BhpkO8Rlg[2019/7/16 12:14:42]
推荐:一个画出高大上的机器学习图的神器(论文必备)
原创:机器学习初学者
机器学习初学
者
本人在写论文的时候,很多图片是用matplotlib和seaborn画的,但是,我还有一个神器,Scikit-plot,
通过这个神器,画出了更加高大上的机器学习图,本文对Scikit-plot做下简单介绍。(作者:黄海广)
安装说明
安装Scikit-plot非常简单,直接用命令:
即可完成安装。
仓库地址:
https://github.com/reiinakano/scikit-plot
里面有使用说明和样例(py和ipynb格式)。
使用说明
简单举几个例子
比如画出分类评级指标的ROC曲线的完整代码:
from sklearn.datasets import load_digits
from sklearn.model_selection import train_test_split
from sklearn.naive_bayes import GaussianNB
X, y = load_digits(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.33)
nb = GaussianNB()
nb.fit(X_train, y_train)
predicted_probas = nb.predict_proba(X_test)
# The magic happens here
import matplotlib.pyplot as plt
import scikitplot as skplt
skplt.metrics.plot_roc(y_test, predicted_probas)
plt.show()
效果如图(相当高大上!)
图:ROC曲线
P-R曲线就是精确率precision vs 召回率recall 曲线,以recall作为横坐标轴,precision