Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. X | y
  2. feature1 feature2 | label
  3. --------------------+------
  4. 0.1 0.3 | 0
  5. 0.2 0.1 | 1
  6. 0.7 0.5 | 1
  7. 0.8 0.3 | 1
  8. 0.6 0.6 | 1 (but also 0 - so probably should be 0 and 1 - class 2?)
  9. 0.3 0.9 | 0
  10. 0.5 0.5 | 0 (but also 1 - so probably should be both as well- class 2?)
  11.  
  12. X | Y
  13. feature1 feature2 | class0? class1?
  14. --------------------+-----------------
  15. 0.1 0.3 | 1 0
  16. 0.2 0.1 | 0 1
  17. 0.7 0.5 | 0 1
  18. 0.8 0.3 | 0 1
  19. 0.6 0.6 | 1 1
  20. 0.3 0.9 | 1 0
  21. 0.5 0.5 | 1 1
  22.  
  23. import numpy as np
  24. from sklearn.ensemble import RandomForestClassifier
  25.  
  26. X = np.random.random((3, 3))
  27. Y = np.array([[0, 1],
  28. [1, 0],
  29. [1, 1]])
  30. model = RandomForestClassifier()
  31. model.fit(X, Y)
  32. model.predict(X)
  33.  
  34. np.array([[0., 1.],
  35. [1., 0.],
  36. [1., 1.]])
  37.  
  38. model.predict_proba(X)
  39.  
  40. [np.array([[0.6, 0.4],
  41. [0.7, 0.3],
  42. [0.1, 0.9]]),
  43. np.array([[0.9, 0.1],
  44. [1., 0. ],
  45. [0.2, 0.8]])]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement