本文整理汇总了Python中keras.models.Sequential.stop_training方法的典型用法代码示例。如果您正苦于以下问题:Python Sequential.stop_training方法的具体用法?Python Sequential.stop_training怎么用?Python Sequential.stop_training使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类keras.models.Sequential
的用法示例。
在下文中一共展示了Sequential.stop_training方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: range
# 需要导入模块: from keras.models import Sequential [as 别名]
# 或者: from keras.models.Sequential import stop_training [as 别名]
callbacks._set_model(model)
callbacks._set_params({
'batch_size': batch_size,
'nb_epoch': nb_epoch,
'nb_sample': nb_train_sample,
'verbose': 1,
'do_validation': do_validation,
'metrics': metrics,
})
##########################
# TRAINING
##########################
callbacks.on_train_begin()
model.stop_training = False
for epoch in range(nb_epoch):
callbacks.on_epoch_begin(epoch)
if shuffle_on_epoch_start:
X_train, y_train = util.shuffle_data(X_train, y_train)
# train
util.train_on_batch(model, X_train, y_train, nb_classes,
callbacks=callbacks,
normalize=normalize_data,
batch_size=batch_size,
class_weight=class_weight,
shuffle=False)
epoch_logs = {}