Implementation explanation for predict_proba in RandomForestClassifier- sklearn

Attached is an extract from the RandomForestClassifier documentation of sklearn. The last line,"The class probabilities of a single tree is the fraction of samples of the same class in a leaf." is something I am not able to grasp, Could someone please help me understand this.!!!!

Topic predict implementation probability random-forest scikit-learn

Category Data Science


It's explaining how the predict_proba works. If at the lowest level of the tree, you have 80 samples of class 1 and 20 samples of class 0 in a leaf. then the class probability of 1 is 80 / ( total number of class1 samples in the whole population ), and the mean of those class probabilities across all trees is computed. And that's how you get the results from the predict_proba method.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.