Skip to content

Commit

Permalink
Update c_msel_tr_loss.py
Browse files Browse the repository at this point in the history
  • Loading branch information
smilesun authored Oct 8, 2023
1 parent 5775c10 commit 23accdb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion domainlab/algos/msels/c_msel_tr_loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def __init__(self, max_es):
self.max_es = max_es
super().__init__()

def update(self):
def update(self, clear_counter=False):
"""
if the best model should be updated
"""
Expand All @@ -34,6 +34,9 @@ def update(self):
logger.info(f"early stop counter: {self.es_c}")
logger.info(f"loss:{loss}, best loss: {self.best_loss}")
flag = False # do not update best model
if clear_counter:
logger.info("clearing counter")
self.es_c = 0
return flag

def if_stop(self):
Expand Down

0 comments on commit 23accdb

Please sign in to comment.