擅长:python、mysql、java
<p><a href="https://en.wikipedia.org/wiki/Root-mean-square_deviation" rel="noreferrer">root mean square error</a>的公式是:</p>
<p><a href="https://i.stack.imgur.com/oeNfI.png" rel="noreferrer"><img src="https://i.stack.imgur.com/oeNfI.png" alt="enter image description here"/></a></p>
<p>在TF中实现它的方法是<code>tf.sqrt(tf.reduce_mean(tf.squared_difference(Y1, Y2)))</code>。</p>
<hr/>
<p>需要记住的重要一点是,没有必要使用优化器将RMSE损失最小化。使用相同的结果,您可以将<code>tf.reduce_mean(tf.squared_difference(Y1, Y2))</code>甚至<code>tf.reduce_sum(tf.squared_difference(Y1, Y2))</code>最小化,但是因为它们有更小的操作图,所以优化速度会更快。</p>
<p>但如果您只想跟踪RMSE的值,则可以使用此函数。</p>