首页 文章

如何在多类分类任务中校准神经网络输出层的阈值?

提问于
浏览
1

假设我们有 multi-class classification task with 3 classes

{芝士蛋糕,冰淇淋,苹果派}

鉴于我们有一个训练有素的神经网络,可以对随机厨师更喜欢的三种甜点中的哪一种进行分类 . 另外,假设 output layer consists of 3 neurons with softmax activation, such that each neuron represents the probability to like the corresponding dessert .

例如,此类网络的可能输出可能是:

输出(chef_1)= {P(芝士蛋糕)= 0.3; P(冰淇淋)= 0.1; P(Apple Pie)= 0.6; }

输出(chef_2)= {P(芝士蛋糕)= 0.2; P(冰淇淋)= 0.1; P(Apple Pie)= 0.7; }

输出(chef_3)= {P(芝士蛋糕)= 0.1; P(冰淇淋)= 0.1; P(Apple Pie)= 0.8; }

在这种情况下,所有实例(chef_1,chef_2和chef_3)可能更喜欢Apple Pie,但信心不同(例如,chef_3更可能更喜欢Apple Pie而不是chef_1,因为网络概率输出分别为0.8和0.6)

鉴于我们有一个新的 dataset of 1000 chefs, and we want to calculate the distribution of their favorite desserts ,我们只需对1000名厨师中的每一位进行分类,并根据神经元最大可能性确定他最喜欢的甜点 .

我们也想 improve the prediction accuracy by discarding chefs whose max prediction probability is below 0.6. Let's assume that 200 out of the 1000 were predicted with such probability, and we discarded them.

在这种情况下, we may bias distribution over the 800 chefs (who were predicted with a probability higher than 0.6) if one dessert is easier to predict than another.

例如,如果类的平均预测概率是:

AverageP(芝士蛋糕)= 0.9

AverageP(冰淇淋)= 0.5

AverageP(Apple Pie)= 0.8

我们 discard chefs who were predicted with probability which is lower than 0.6, among the 200 chefs that were discarded there are likely to be more chefs who prefer Ice Cream, and this will result in a biased distribution among the other 800.

经过这么长时间的介绍(我很高兴您还在阅读),我的问题是:

  • 我们每个 class 都需要不同的门槛吗? (例如,在Cheesecake预测中丢弃概率低于X的实例,在Ice Cream预测中丢弃概率低于Y的实例,并且在Apple Pie预测中丢弃概率低于Z的实例) .

  • 如果是, how can I calibrate the thresholds without impacting the overall distribution 在我的1000名厨师数据集上(即为了提高准确性而丢弃预测概率较低,同时保留原始数据集上的分布) .

我已经尝试使用每个类的平均预测概率作为阈值,但我不能保证它不会影响分布(因为这些阈值可能过度适应测试集而不是1000厨师数据集) .

有什么建议或相关文件吗?

1 回答

  • 0

    我有类似的多标签问题 . 我已经将每个级别的F1分数绘制到阈值,以查看每个级别的最大F1分数在哪里 . 每个 class 都有所不同 . 对于某些人来说,精确度与召回率在阈值> 0.8时更高,而对于某些人来说甚至低至0.4 . 我选择了不同的门槛来将 class 称为 class . 但我想如果你不想偏向一个高精度或高召回的类,你可以根据测试集选择不同的阈值(你可以优化测试集集合)

相关问题