如果没有任何改进,我尝试使用回调来停止迭代,但是会遇到此错误:
TypeError: unsupported operand type(s) for +: 'EarlyStopping' and 'list'
共享产生上述错误的代码。
sgd = krs.optimizers.SGD(lr=0.01, decay=1e-6, momentum=0.9, nesterov=True)
model.compile(
optimizer = "sgd",
loss = "binary_crossentropy",
metrics = ["accuracy"]
)
results = model.fit(
train_X, train_Y
,epochs = 10
,batch_size = 100
,class_weight = {1:10.11, 0:1}
,shuffle = 1
,validation_data = (test_X, test_Y)
,verbose = 1
,callbacks = krs.callbacks.EarlyStopping(monitor='val_loss', min_delta = 0, patience=2, verbose=0, mode="auto")
)