Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Listing 18
- x3=np.arange(1,51)
- y3=np.zeros(50)
- y3[25:50]= 1
- y3[20:25:2] = 1
- y3[25:29:2] = 0
- x3 = x3.reshape(-1, 1)
- clf = linear_model.LogisticRegression(C=1e5, solver='lbfgs')
- clf.fit(x3, y3)
- sigmuid_prob = logistic_mispredict_proba(x3).flatten()
- prob = logistic_mispredict_proba(x3_test)
- plt.scatter(x3, y3, color='black', zorder=10)
- plt.plot(x3_test, prob, color='red', linewidth=5)
- plt.xlabel("x" , fontsize=14)
- plt.ylabel("p" , fontsize=14)
- plt.show()
- fpr, tpr, threshold = metrics.roc_curve(y3, sigmuid_prob)
- roc_auc = metrics.auc(fpr, tpr)
- plt.plot(fpr, tpr, 'b', label = "AUC = %0.2f" % roc_auc)
- plt.legend(loc = "upper left")
- plt.plot([0,1],[0,1], 'r--')
- plt.xlabel("False Positive Rate" , fontsize=12)
- plt.ylabel("True Positive Rate" , fontsize=12)
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement