我正在尝试在Tensorflow中构建一个简单的神经网络,但我有一个关于梯度优化的问题。
这可能是一个天真的问题,但我是否必须设置停止优化器的条件?下面是我的网络打印输出示例,您可以看到迭代后(所有数据的批量梯度下降)66,成本开始再次增加。那么 me 是否确保优化器在此时停止? (注意:我没有在这里输出所有输出,但随着迭代次数的增加,成本开始呈指数级增长。)
感谢任何指导。
iteration 64 with average cost of 654.621 and diff of 0.462708
iteration 65 with average cost of 654.364 and diff of 0.257202
iteration 66 with average cost of 654.36 and diff of 0.00384521
iteration 67 with average cost of 654.663 and diff of -0.302368
iteration 68 with average cost of 655.328 and diff of -0.665161
iteration 69 with average cost of 656.423 and diff of -1.09497
iteration 70 with average cost of 658.011 and diff of -1.58826
答案 0 :(得分:3)
这是正确的 - TensorFlow tf.train.Optimizer
类暴露了operation that you can run to take one (gradient descent-style) step,但是它们不监视成本的当前值或决定何时停止,因此一旦网络开始,您可能会看到成本增加过拟合。