Advertisement
Guest User

Untitled

a guest
Oct 19th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. # Listing 15
  2. x5=np.arange(1,101)
  3. y5=np.zeros(100)
  4. y5[1:100:2]= 1
  5.  
  6. x5 = x5.reshape(-1, 1)
  7. clf = linear_model.LogisticRegression(C=1e5, solver='lbfgs')
  8. clf.fit(x5, y5)
  9.  
  10. x_test = np.linspace(0, 100, 500).reshape(-1,1)
  11. probs = clf.predict_proba(x_test)
  12. prob=probs[:,1]
  13.  
  14. plt.scatter(x5, y5, color='black', zorder=20)
  15. plt.plot(x_test, prob, color='red', linewidth=5)
  16. plt.xlabel("x" , fontsize=14)
  17. plt.ylabel("p" , fontsize=14)
  18.  
  19. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement