python - CNTK 绝对错误

标签 python machine-learning deep-learning cntk

要找到训练模型期间的损失,我们可以使用 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/

相关文章:

python - 检查 python 系列是否包含另一个列表中的任何字符串

python - 如何交换元组中的元素?

python - 如何使用 Django/Python 在 SQLite 中存储获取的 JSON 数据

python - 如何使用与其他两列匹配的Python填充数据集中的空值?

python - 在 Caffe 中绘制网络时出错

image-processing - 我应该如何使用预训练模型优化用于图像分类的神经网络

python - 链接 python app docker 和 postgres docker

python - 使用python拟合先知模型时出现问题

python - 如何在 Pytorch 中检查模型是否处于训练或评估模式?

machine-learning - 当有多个分支时,caffe如何计算梯度?