要找到训练模型期间的损失,我们可以使用 cntk.squared_error()
函数,如下所示:
loss = cntk.squared_error(z, l)
但我有兴趣找到绝对误差方面的损失。以下代码不起作用:
loss = cntk.absolute_error(z, l)
错误如下:
AttributeError: module 'cntk' has no attribute 'absolute_error'
CNTK 工具包中是否有内置函数来查找绝对错误?我是深度学习的新手,所以我了解的不多。感谢您的帮助!
最佳答案
CNTK 中没有开箱即用的 L1 损失函数,但您可以提供自定义函数:
def absolute_error(z, l):
return cntk.reduce_mean(cntk.abs(z - l))
关于python - CNTK 绝对错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46753234/