Get learning rate which has steepest gradient and its corresponding loss Args: skip_start: number of batches to trim from the start. skip_end: number of batches to trim from the end. Returns: Learning rate which has steepest gradient and its corr
(self, skip_start: int = 0, skip_end: int = 0)
| 466 | return lrs, losses |
| 467 | |
| 468 | def get_steepest_gradient(self, skip_start: int = 0, skip_end: int = 0) -> tuple[float, float] | tuple[None, None]: |
| 469 | """Get learning rate which has steepest gradient and its corresponding loss |
| 470 | |
| 471 | Args: |
| 472 | skip_start: number of batches to trim from the start. |
| 473 | skip_end: number of batches to trim from the end. |
| 474 | |
| 475 | Returns: |
| 476 | Learning rate which has steepest gradient and its corresponding loss |
| 477 | """ |
| 478 | lrs, losses = self.get_lrs_and_losses(skip_start, skip_end) |
| 479 | |
| 480 | try: |
| 481 | min_grad_idx = np.gradient(np.array(losses)).argmin() |
| 482 | return lrs[min_grad_idx], losses[min_grad_idx] |
| 483 | except ValueError: |
| 484 | print("Failed to compute the gradients, there might not be enough points.") |
| 485 | return None, None |
| 486 | |
| 487 | def plot( |
| 488 | self, |