RandomForest returns wrong number of trees I am trying to predict churn of customer using Random Forest. I am following this article.
However I am stuck with part 8 (ln[8] and Out[8]) - I want to use only 10 estimators (to have only 10 trees) so predictors are all multiples of 0.1.
Below, I simplified my code to just clean the data, predict the model and see the estimators, but they are not multiples of 0.1. Why? 
churn_df = pd.read_csv('C:/path')
col_names = churn_df.columns.tolist()

#Separate target data
churn_res = churn_df['CLI_ACT']
y = np.where(churn_res == True,1,0)

#Drop useless columns now
to_drop = ['   ', 'CLI_ID_S', 'LST_MONTH_PAY', 'CLI_ACT']
churn_clean = churn_df.drop(to_drop,axis=1)

#Convert training data to numpy matrix as floats
X = churn_clean.as_matrix().astype(np.float)

#Standardize the data
from sklearn.preprocessing import StandardScaler
scaler = StandardScaler()
X = scaler.fit_transform(X)

from sklearn.cross_validation import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X,y,test_size=0.3,random_state=0)

prob = RF(n_estimators=10).fit(X_train,y_train).predict_proba(X_test)
print np.unique(prob)

The output array has 38 elements(=Trees) with various probabilities (0, 0.3333, 0.937...) instead of array of 10 elements(=Trees) from 0.0 to 1.0 by 0.1.
 A: Per the relevant sklearn docs, predict_proba() returns an array with dimensions equal to the number of samples and the number of classes. (NB that the number of classes is not the number of trees.) More, the returned probabilities are the average of the trees:

The predicted class probabilities of an input sample is computed as the mean predicted class probabilities of the trees in the forest.

Per the np.unique() docs, this array will be flattened if it's more than single-dimensional. Meaning, without your data at hand, there's really no way to know why you're winding up with 38 elements. But in any case, you wouldn't expect predicted probability dimension to align with the number of classifiers.
Since predict_proba() averages the predictions of the set of $k$ classifiers, it will only give a multiple $\frac{1}{k}$ when all of these classifiers give $0$ or $1$ probabilities for a given datum. This will only occur when:


*

*The data are separable by a set of boolean conjunctions. Meaning, rules can be constructed such that every node of the tree is solely of a single class.

*The trees are trained to adequate depth to fully fit—overfit, some might say—the data.


If your code is working to separate toy sets, say load_digits() in sklearn, it would seem your data can't be fully separated by decision trees.
RandomForestClassifier does make the underlying classifiers available, however, as detailed in this SO answer. To get a clearer picture, you could access this attribute to find the predictions of the underlying trees.
