mca*_*zzi 5 optimization gradient tensorflow
我正在尝试在 Tensorflow 中构建一个简单的神经网络,但我有一个关于梯度优化的问题。
这可能是一个幼稚的问题,但我是否必须设置条件来停止优化器?下面是来自我的网络的示例打印输出,您可以看到在迭代(所有数据的批量梯度下降)66 之后,成本再次开始增加。那么是否由我来确保优化器此时停止?(注意:我没有把所有的输出都放在这里,但是随着迭代次数的增加,成本开始呈指数增长)。
感谢您的任何指导。
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
Run Code Online (Sandbox Code Playgroud)
这是正确的 - TensorFlowtf.train.Optimizer
类公开了一个操作,您可以运行该操作来执行一个(梯度下降式)步骤,但它们不会监视成本的当前值或决定何时停止,因此一旦网络停止运行,您可能会看到成本增加开始过度拟合。
归档时间: |
|
查看次数: |
776 次 |
最近记录: |