Advertisement
Guest User

Untitled

a guest
Dec 17th, 2018
1,158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.34 KB | None | 0 0
  1. from sklearn.linear_model import LogisticRegression
  2. import numpy as np
  3. x1 = np.random.randn(100)
  4. x2 = x1 + 0.00001*np.random.randn(100)
  5. x3 = np.random.randn(100)
  6. y = ((100*x1 - 100*x2 + x3) > 0).astype(int)
  7. X = np.vstack([x1, x2, x3]).T
  8.  
  9. m = LogisticRegression().fit(X, y)
  10. print(np.std(X, 0)*m.coef_)
  11.  
  12. >> [[0.02823824 0.02824964 3.70616255]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement