我正在使用基因组数据研究多标签分类 NN。每个样本有 10 个样本和 2 个真实标签(年龄和性别)。我在最后一层使用了 sigmoid 激活,因为样本不再受限于跨类的概率分布,所以我得到的样本对于多个年龄可能具有 0.5 或更高的概率 - 例如 age1 和 age2。由于这是基因组数据,这并不奇怪,尤其是年龄分布。
我正在使用 sklearn 生成混淆矩阵以及精度和召回报告
from sklearn.metrics import classification_report, multilabel_confusion_matrix
preds_train = model.predict(X_train)
preds_test = model.predict(X_test)
preds_train = preds_train > 0.5
preds_test = preds_test > 0.5
preds_train = tf.cast(preds_train, tf.float32)#one-hot predictions
preds_test = tf.cast(preds_test, tf.float32)
print(classification_report(y_true_train, preds_train))
print(classification_report(y_true_test, preds_test))
multilabel_confusion_matrix(targets_train, np.array(preds_train))
如前所述,我遇到了这样一种情况,其中一些样本的正确概率和“不正确”类的概率超过 0.5,产生一个包含该样本的三个 1 而不是两个 1 的单热向量。这意味着这些样本在评估该类的精确召回和 F1 时会变成真阳性,而对于不正确的类则是假阳性。
我的问题是,原则上这是可以和有效的吗?除了提高门槛还有什么可以做的吗?
我倾向于说准确率、召回率和 F1仍然是正确的,因为如果样本是 TP 和 FP 如果这只是存在的模式并代表未来预测可能显示的内容,那么这并不重要!
我很感激任何意见。谢谢!