Skip to content

Instantly share code, notes, and snippets.

View ChongWu-Biostat's full-sized avatar

Chong Wu ChongWu-Biostat

  • The University of Texas MD Anderson Cancer Center
  • Houston
View GitHub Profile
@jeremyjordan
jeremyjordan / sgdr.py
Last active December 4, 2023 13:41
Keras Callback for implementing Stochastic Gradient Descent with Restarts
from keras.callbacks import Callback
import keras.backend as K
import numpy as np
class SGDRScheduler(Callback):
'''Cosine annealing learning rate scheduler with periodic restarts.
# Usage
```python
schedule = SGDRScheduler(min_lr=1e-5,