MCPcopy Create free account
hub / github.com/chengsen/PyTorch_TextGCN / __init__

Method __init__

utils.py:157–174  ·  view source on GitHub ↗

Args: patience (int): How long to wait after last time validation loss improved. Default: 7 verbose (bool): If True, prints a message for each validation loss improvement. Default: False delta (float

(self, patience=7, verbose=False, delta=0)

Source from the content-addressed store, hash-verified

155 """Early stops the training if validation loss doesn't improve after a given patience."""
156
157 def __init__(self, patience=7, verbose=False, delta=0):
158 """
159 Args:
160 patience (int): How long to wait after last time validation loss improved.
161 Default: 7
162 verbose (bool): If True, prints a message for each validation loss improvement.
163 Default: False
164 delta (float): Minimum change in the monitored quantity to qualify as an improvement.
165 Default: 0
166 """
167 self.patience = patience
168 self.verbose = verbose
169 self.counter = 0
170 self.best_score = None
171 self.early_stop = False
172 self.val_loss_min = np.Inf
173 self.delta = delta
174 self.model_path = "hdd_data/prepare_dataset/model/model.pt"
175
176 def __call__(self, val_loss, model=None):
177

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected