MCPcopy Create free account
hub / github.com/geekcomputers/Python / __call__

Method __call__

ML/src/python/neuralforge/utils/metrics.py:102–120  ·  view source on GitHub ↗
(self, score: float)

Source from the content-addressed store, hash-verified

100 self.early_stop = False
101
102 def __call__(self, score: float) -> bool:
103 if self.best_score is None:
104 self.best_score = score
105 return False
106
107 if self.mode == 'min':
108 improved = score < (self.best_score - self.min_delta)
109 else:
110 improved = score > (self.best_score + self.min_delta)
111
112 if improved:
113 self.best_score = score
114 self.counter = 0
115 else:
116 self.counter += 1
117 if self.counter >= self.patience:
118 self.early_stop = True
119
120 return self.early_stop
121
122class ConfusionMatrix:
123 def __init__(self, num_classes: int):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected