Skip to content

Early Stopping issue #4

@GDam90

Description

@GDam90

Hi ozmig, thanks for your great work, i found it very interesting and thanks for publishing your code!

I may have found an issue that prevents the early stopping mechanism in line 87 of dcnet/base/base_trainer.py:

dcnet/base/base_trainer.py

Lines 87 to 108 in 68c79d3

not_improved_count = 0
if epoch > self.val_epoch:
if self.mnt_mode != 'off':
try:
# check whether specified metric improved or not, according to
# specified metric(mnt_metric)
lower = log[self.mnt_metric] <= self.mnt_best
higher = log[self.mnt_metric] >= self.mnt_best
improved = (self.mnt_mode == 'min' and lower) or \
(self.mnt_mode == 'max' and higher)
except KeyError:
msg = "Warning: Metric '{}' not found, perf monitoring is disabled."
self.logger.warning(msg.format(self.mnt_metric))
self.mnt_mode = 'off'
improved = False
not_improved_count = 0
if improved:
self.mnt_best = log[self.mnt_metric]
not_improved_count = 0
best = True

should that line be commented? you want the not_improving_count = 0 only if improved flag is True as in lines 105-108.

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions