Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.6k views
in Technique[技术] by (71.8m points)

why the ROC of Naïve Bayes that I plotted, does not start from zero?

I want to plot the Naive Bayes ROC curve, but it doesn't start from zero! how can I solve the problem? also, I don't get any error!

from sklearn.naive_bayes import GaussianNB
classifierNB= GaussianNB()
classifierNB.fit(xtrain,train)

ypredNB = classifierNB.predict(xtest)
ypredNB_P = classifierNB.predict_proba(xtest)[:,1]

print('

ypred NB is:-----------------------
', ypredNB)
print('

ypred NB is:-----------------------
', ypredNB_P)

#9-1 ROC naive Bayes

from sklearn.metrics import roc_curve
from sklearn. metrics import AUC

y_scores_NB = classifierNB.predict_proba(xtest)
fpr_NB, tpr_NB, threshold_NB = roc_curve(ytest, y_scores_NB[:, 1])
roc_auc_NB = auc(fpr_NB, tpr_NB)

plt.title('Receiver Operating Characteristic')
plt.plot(fpr_NB, tpr_NB, 'b', label = 'AUC = %0.2f' % roc_auc_SV)
plt.legend(loc = 'lower right')
plt.plot([0, 1], [0, 1],'r--')
plt.xlim([0, 1])
plt.ylim([0, 1])
plt.ylabel('True Positive Rate')
plt.xlabel('False Positive Rate')
plt.title('ROC Curve of NB')
plt.show()
question from:https://stackoverflow.com/questions/65906153/why-the-roc-of-na%c3%afve-bayes-that-i-plotted-does-not-start-from-zero

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...