How do you get a probability of all classes to predict without building a classifier for each single class?
<p>Given a classification problem, sometimes we do not just predict a class, but need to return the probability that it is a class.</p>

<p>i.e. P(y=0|x), P(y=1|x), P(y=2|x), ..., P(y=C|x)</p>

<p>Without building a new classifier to predict y=0, y=1, y=2... y=C respectively. Since training C classifiers (let's say C=100) can be quite slow.</p>

<p>What can be done to do this? What classifiers naturally can give all probabilities easily (one I know is using neural network with 100 out nodes)? But if I use traditional random forests, I can't do that, right? I use the Python Scikit-Learn library.</p>

<p>If you want probabilities, look for sklearn-classifiers that have method: predict_proba()</p>

<p>Sklearn documentation about multiclass:[<a href="http://scikit-learn.org/stable/modules/multiclass.html]" rel="nofollow">http://scikit-learn.org/stable/modules/multiclass.html]</a></p>

<p>All scikit-learn classifiers are capable of multiclass classification. So you don't need to build 100 models yourself.</p>

<p>Below is a summary of the classifiers supported by scikit-learn grouped by strategy:</p>

<ul>
<li>Inherently multiclass: Naive Bayes, LDA and QDA, Decision Trees,
Random Forests, Nearest Neighbors, setting multi_class='multinomial'
in sklearn.linear_model.LogisticRegression. </li>
<li>Support multilabel: Decision Trees, Random Forests, Nearest Neighbors, Ridge Regression.</li>
<li>One-Vs-One: sklearn.svm.SVC. </li>
<li>One-Vs-All: all linear models exceptsklearn.svm.SVC.</li>
</ul>

python machine-learning scikit-learn