title: How does sklearn's MLP predict_proba function work internally?
body: <p>I am trying to understand how <a href="https://scikit-learn.org/stable/modules/generated/sklearn.neural_network.MLPClassifier.html" rel="nofollow noreferrer"><code>sklearn</code>'s MLP Classifier</a> retrieves its results for its <code>predict_proba</code> function.</p>
  
  <p>The website simply lists:</p>
  
  <blockquote>
    <p>Probability estimates</p>
  </blockquote>
  
  <p>While many others, such as <a href="https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html#sklearn.linear_model.LogisticRegression.predict_proba" rel="nofollow noreferrer">logistic regression</a>, have more detailed answers:
  Probability estimates.</p>
  
  <p>The returned estimates for all classes are ordered by the label of classes.</p>
  
  <blockquote>
    <p>For a multi_class problem, if multi_class is set to be “multinomial”
    the softmax function is used to find the predicted probability of each
    class. Else use a one-vs-rest approach, i.e calculate the probability
    of each class assuming it to be positive using the logistic function.
    and normalize these values across all the classes.</p>
  </blockquote>
  
  <p>Other model types, too, have more detail. Take for example a <a href="https://scikit-learn.org/stable/modules/generated/sklearn.svm.SVC.html" rel="nofollow noreferrer">support vector machine classifier</a></p>
  
  <p>And there is also <a href="https://stackoverflow.com/questions/15111408/how-does-sklearn-svm-svcs-function-predict-proba-work-internally">this very nice Stack Overflow post</a> which explains it in depth.</p>
  
  <blockquote>
    <p>Compute probabilities of possible outcomes for samples in X.</p>
    
    <p>The model need to have probability information computed at training
    time: fit with attribute probability set to True.</p>
  </blockquote>
  
  <p><strong>Other Examples</strong></p>
  
  <p><a href="https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.RandomForestClassifier.html#sklearn.ensemble.RandomForestClassifier.predict_proba" rel="nofollow noreferrer">Random Forest</a>:</p>
  
  <blockquote>
    <p>Predict class probabilities for X.</p>
    
    <p>The predicted class probabilities of an input sample are computed as
    the mean predicted class probabilities of the trees in the forest. The
    class probability of a single tree is the fraction of samples of the
    same class in a leaf.</p>
  </blockquote>
  
  <p><a href="https://scikit-learn.org/stable/modules/generated/sklearn.gaussian_process.GaussianProcessClassifier.html#sklearn.gaussian_process.GaussianProcessClassifier" rel="nofollow noreferrer">Gaussian Process Classifier:</a></p>
  
  <p>I am looking to understand the same thing as the above post, but for the <code>MLPClassifier</code>. How does the <code>MLPClassifier</code> work internally?</p>