看起来你可以只使用 keras 的回调; 如果你真的想要它在包装中,从here抓住它并把它放在here.否则,我会尝试:
代码语言:javascript
复制
from keras.callbacks import EarlyStopping
early_stop = EarlyStopping(patience=69) # epochs stagnation before termination
# from their example cem_cartpole.py
cem.fit(env, nb_steps=100000, visualize=False, callbacks=[early_stop], verbose=2)