[英]How to hold the output of a model at each training epoch in tensorflow 1.x?
I am trying to implement a constraint on the output of a neural network using the output of the previous training epoch.我正在尝试使用前一个训练时期的输出对神经网络的输出实施约束。 I tried using tf.assign() to update the value of a variable that holds the output, but it turned out that it holds the initial value.
我尝试使用 tf.assign() 来更新保存输出的变量的值,但结果证明它保存了初始值。
You must use callbacks.您必须使用回调。 It's my example for maximum scorу:
这是我获得最大分数的示例:
checkpoint_precision = ModelCheckpoint(filepath='best-weights, precision_selu_pr.hdf5', monitor='val_precision', mode='max', verbose=1, save_best_only=True)
checkpoint_auc = ModelCheckpoint(filepath='best-weights-auc_selu_pr.hdf5', monitor='val_auc', mode='max', verbose=1, save_best_only=True)
model.fit(x=data_x, y=Y, batch_size=100, epochs=100000, validation_data (x_val_scaled, Y_val), callbacks=[checkpoint_precision, checkpoint_auc])
For more information you can use this link: https://www.tensorflow.org/api_docs/python/tf/keras/callbacks有关更多信息,您可以使用此链接: https : //www.tensorflow.org/api_docs/python/tf/keras/callbacks
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.