Skip to content

Instantly share code, notes, and snippets.

View sansmoraxz's full-sized avatar
🗺️
Optimizing mana flows

Souyama sansmoraxz

🗺️
Optimizing mana flows
View GitHub Profile
@sansmoraxz
sansmoraxz / sgdr.py
Created September 30, 2018 14:26 — forked from jeremyjordan/sgdr.py
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,