| 45 | plt.close() |
| 46 | |
| 47 | def plot_learning_rate( |
| 48 | lr_history: List[float], |
| 49 | save_path: Optional[str] = None, |
| 50 | figsize: tuple = (10, 5) |
| 51 | ): |
| 52 | plt.figure(figsize=figsize) |
| 53 | plt.plot(lr_history, linewidth=2) |
| 54 | plt.xlabel('Step') |
| 55 | plt.ylabel('Learning Rate') |
| 56 | plt.title('Learning Rate Schedule') |
| 57 | plt.grid(True, alpha=0.3) |
| 58 | plt.yscale('log') |
| 59 | |
| 60 | if save_path: |
| 61 | os.makedirs(os.path.dirname(save_path), exist_ok=True) |
| 62 | plt.savefig(save_path, dpi=300, bbox_inches='tight') |
| 63 | print(f"Learning rate plot saved to {save_path}") |
| 64 | |
| 65 | plt.close() |
| 66 | |
| 67 | def plot_confusion_matrix( |
| 68 | cm: np.ndarray, |