Skip to content

Instantly share code, notes, and snippets.

View pippo111's full-sized avatar

Filip Barańczuk pippo111

  • Częstochowa, Poland
View GitHub Profile
@pippo111
pippo111 / reinit_falsestart_callback.py
Last active August 21, 2019 11:48
Keras callback for reinitialize model weights when 'vall_loss' metric is not improving from the start.
import numpy as np
from keras import backend as K
from keras.callbacks import Callback
class ReinitWeightOnFalseStart(Callback):
"""Reinitializes model weights when model is not improving right after beginning.
Stops training after number of trials.
If model starts improving then behave like