Python SKL如何学习';s MLP预测概率函数是否在内部工作?

Python SKL如何学习';s MLP预测概率函数是否在内部工作?,python,machine-learning,scikit-learn,probability,mlp,Python,Machine Learning,Scikit Learn,Probability,Mlp,我试图了解如何为其predict\u proba函数检索结果 该网站仅列出: 概率估计 而其他许多人,例如,有更详细的答案: 概率估计 所有类别的返回估计值按类别标签排序 对于多类问题,如果将多类设置为“多项式” softmax函数用于查找每个事件的预测概率 班级。否则使用一对一方法,即计算概率 使用逻辑函数假设其为正的每个类。 并在所有类中规范化这些值 其他模型类型也有更多细节。以a为例 还有一个更深入的解释 计算X中样本可能结果的概率 该模型需要在训练时计算概率信息 时间:拟合属性概率设置为

我试图了解如何为其
predict\u proba
函数检索结果

该网站仅列出:

概率估计

而其他许多人,例如,有更详细的答案: 概率估计

所有类别的返回估计值按类别标签排序

对于多类问题,如果将多类设置为“多项式” softmax函数用于查找每个事件的预测概率 班级。否则使用一对一方法,即计算概率 使用逻辑函数假设其为正的每个类。 并在所有类中规范化这些值

其他模型类型也有更多细节。以a为例

还有一个更深入的解释

计算X中样本可能结果的概率

该模型需要在训练时计算概率信息 时间:拟合属性概率设置为True

其他示例

:

预测X的类概率

输入样本的预测类别概率计算如下: 森林中树木的平均预测类概率。这个 一棵树的类概率是该树样本的分数 一片叶子上的同一类

我希望了解与上述文章相同的内容,但对于
mlpclassizer
mlpclassizer
如何在内部工作?

查看内部,我发现:

def _initialize(self, y, layer_units):

    # set all attributes, allocate weights etc for first call
    # Initialize parameters
    self.n_iter_ = 0
    self.t_ = 0
    self.n_outputs_ = y.shape[1]

    # Compute the number of layers
    self.n_layers_ = len(layer_units)

    # Output for regression
    if not is_classifier(self):
        self.out_activation_ = 'identity'
    # Output for multi class
    elif self._label_binarizer.y_type_ == 'multiclass':
        self.out_activation_ = 'softmax'
    # Output for binary class and multi-label
    else:
        self.out_activation_ = 'logistic'
MLP分类器似乎使用逻辑函数进行二值分类,使用softmax函数进行多标签分类,以构建输出层。这表明网络的输出是一个概率向量,网络据此推断预测

如果我看一下
predict\u proba
方法:

def predict_proba(self, X):
    """Probability estimates.
    Parameters
    ----------
    X : {array-like, sparse matrix} of shape (n_samples, n_features)
        The input data.
    Returns
    -------
    y_prob : ndarray of shape (n_samples, n_classes)
        The predicted probability of the sample for each class in the
        model, where classes are ordered as they are in `self.classes_`.
    """
    check_is_fitted(self)
    y_pred = self._predict(X)

    if self.n_outputs_ == 1:
        y_pred = y_pred.ravel()

    if y_pred.ndim == 1:
        return np.vstack([1 - y_pred, y_pred]).T
    else:
        return y_pred
确认softmax或logistic作为输出层的激活函数的动作,以获得概率向量

希望这能对你有所帮助