I am working with scikit-learn library in python. In the code below, I am predicting probability but I don't know how to read the output.
from sklearn.ensemble import RandomForestClassifier as RF from sklearn import cross_validation X = np.array([[5,5,5,5],[10,10,10,10],[1,1,1,1],[6,6,6,6],[13,13,13,13],[2,2,2,2]]) y = np.array([0,1,1,0,1,2])
Split the dataset
X_train, X_test, y_train, y_test = cross_validation.train_test_split(X, y, test_size=0.5, random_state=0)
Calculate the probability
clf = RF() clf.fit(X_train,y_train) pred_pro = clf.predict_proba(X_test) print pred_pro
[[ 1. 0.] [ 1. 0.] [ 0. 1.]]
The X_test list contains 3 arrays (I have 6 samples and test_size=0,5) so output has 3 too.
But I am predicting 3 values (0,1,2) so why I am getting only 2 elements in each array?
How should I read the output?
I also noticed, when I modify the number of distinct values in y, number of columns in output is always distinct count of y -1.