提交 4002fdb7 编写于 作者: J Javier

Added a notebook to illustrate the use of feature importance. And also fixed a...

Added a notebook to illustrate the use of feature importance. And also fixed a little bug related to the calling of the callbacks.
上级 afc6636c
......@@ -655,6 +655,7 @@ class EarlyStopping(Callback):
if self.monitor_op(current - self.min_delta, self.best):
self.best = current
self.wait = 0
self.best_epoch = epoch
if self.restore_best_weights:
self.state_dict = copy.deepcopy(self.model.state_dict())
else:
......@@ -665,7 +666,9 @@ class EarlyStopping(Callback):
def on_train_end(self, logs: Optional[Dict] = None):
if self.stopped_epoch > 0 and self.verbose > 0:
print("Epoch %05d: early stopping" % (self.stopped_epoch + 1))
print(
f"Best Epoch: {self.best_epoch + 1}. Best {self.monitor}: {self.best:.5f}"
)
if self.restore_best_weights and self.state_dict is not None:
if self.verbose > 0:
print("Restoring model weights from the end of the best epoch")
......
......@@ -524,7 +524,7 @@ class Trainer(BaseTrainer):
self.callback_container.on_epoch_end(epoch, epoch_logs, on_epoch_end_metric)
if self.early_stop:
self.callback_container.on_train_end(epoch_logs)
# self.callback_container.on_train_end(epoch_logs)
break
if self.model.with_fds:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册