[英]How to optimize the ratio of (True positive)/(False postive) instead of accuracy?
The classic metrics is "accuracy", which is related to: (True positive + True negative)/(False positive + False negative)经典指标是“准确率”,与:(真阳性+真阴性)/(假阳性+假阴性)有关
In a classification problem, False negative is more tolerable than false positive.在分类问题中,假阴性比假阳性更容易容忍。 That is, I want to assign more weight to improving (True positive)/(False positive).
也就是说,我想分配更多的权重来改善(真阳性)/(假阳性)。 How to accomplish this?
如何做到这一点?
model.compile(optimizer='adam',
loss=tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True),
metrics=['accuracy'])
Tensorflow allows sensitivities to be shifted for these metrics https://www.tensorflow.org/api_docs/python/tf/keras/metrics/SensitivityAtSpecificity , or if you want the false positives directly (which I think only gives you access to the number of false positives if that helps): https://www.tensorflow.org/api_docs/python/tf/keras/metrics/FalsePositives . Tensorflow allows sensitivities to be shifted for these metrics https://www.tensorflow.org/api_docs/python/tf/keras/metrics/SensitivityAtSpecificity , or if you want the false positives directly (which I think only gives you access to the number误报(如果有帮助): https://www.tensorflow.org/api_docs/python/tf/keras/metrics/FalsePositives 。 I do not know much about tensorflow but I hope this helps
我对 tensorflow 不太了解,但我希望这会有所帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.