Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- X | y
- feature1 feature2 | label
- --------------------+------
- 0.1 0.3 | 0
- 0.2 0.1 | 1
- 0.7 0.5 | 1
- 0.8 0.3 | 1
- 0.6 0.6 | 1 (but also 0 - so probably should be 0 and 1 - class 2?)
- 0.3 0.9 | 0
- 0.5 0.5 | 0 (but also 1 - so probably should be both as well- class 2?)
- X | Y
- feature1 feature2 | class0? class1?
- --------------------+-----------------
- 0.1 0.3 | 1 0
- 0.2 0.1 | 0 1
- 0.7 0.5 | 0 1
- 0.8 0.3 | 0 1
- 0.6 0.6 | 1 1
- 0.3 0.9 | 1 0
- 0.5 0.5 | 1 1
- import numpy as np
- from sklearn.ensemble import RandomForestClassifier
- X = np.random.random((3, 3))
- Y = np.array([[0, 1],
- [1, 0],
- [1, 1]])
- model = RandomForestClassifier()
- model.fit(X, Y)
- model.predict(X)
- np.array([[0., 1.],
- [1., 0.],
- [1., 1.]])
- model.predict_proba(X)
- [np.array([[0.6, 0.4],
- [0.7, 0.3],
- [0.1, 0.9]]),
- np.array([[0.9, 0.1],
- [1., 0. ],
- [0.2, 0.8]])]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement