【发布时间】:2018-12-20 03:12:23
【问题描述】:
我想实现一个不对称的损失函数,比如这里引用的
在 TensorFlow 中。
我目前正在使用均方误差损失函数:
mse = tf.reduce_mean(tf.squared_difference(out,Y))
我想替换的 mse = tf.reduce_mean(asymetric_squared_difference(out,Y,alpha))
我查看了 tf.squared_difference 的定义位置,发现https://www.tensorflow.org/api_docs/python/tf/squared_difference 其中说 tensorflow/python/ops/gen_math_ops.py
编辑: 经过大量挖掘之后,从 ops.math_grad 第 999 行到第 1012 行调用 SquaredDifference。但它有很多额外的梯度功能,我不知道如何复制。
如何最好地添加此功能?
【问题讨论】:
标签: python tensorflow loss-function