(self, score: float)
| 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 | |
| 122 | class ConfusionMatrix: |
| 123 | def __init__(self, num_classes: int): |
nothing calls this directly
no outgoing calls
no test coverage detected