keras/examples/mnist_siamese_graph.py 中使用的 keras 示例看起来不正确。下面的函数不是真正的准确度(准确度=(正确预测的类/总测试类))
def compute_accuracy(predictions, labels):
'''Compute classification accuracy with a fixed threshold on distances.
'''
return labels[predictions.ravel() < 0.5].mean()
除此之外,我们还有这个问题,这让我觉得contrastive_loss 和get_pairs 函数也是错误的。有人可以解释这个准确度指标和那些函数吗?
该compute_accuracy功能失常。它目前正在计算精度。它应该是:
def compute_precision(predictions, labels):
'''Compute classification precision with a fixed threshold on distances.
'''
return labels[predictions.ravel() < 0.5].mean()
def compute_accuracy(predictions, labels):
'''Compute classification accuracy with a fixed threshold on distances.
'''
return np.mean(np.equal(predictions.ravel() < 0.5, labels))
我还不确定这个问题,但修复精度功能似乎工作正常。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句