我在 tensorflow 中有成本函数。
activation = tf.add(tf.mul(X, W), b)
cost = (tf.pow(Y-y_model, 2)) # use sqr error for cost function
我正在尝试 this example .如何将其更改为 rmse 成本函数?
最佳答案
tf.sqrt(tf.reduce_mean(tf.square(tf.subtract(targets, outputs))))
并略微简化(TensorFlow 重载了最重要的运算符):
tf.sqrt(tf.reduce_mean((targets - outputs)**2))
关于python - 如何在tensorflow中设置rmse成本函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33846069/