Ejemplo n.º 1
0
    def __init__(monitor,
                 minimize=['loss'],
                 maximize=[],
                 smoothing=.6,
                 patience=None,
                 max_epoch=1000):

        # Internal attributes
        monitor._ewma = util.ExpMovingAve(alpha=1 - smoothing)
        monitor._raw_metrics = []
        monitor._smooth_metrics = []
        monitor._epochs = []
        monitor._is_good = []

        # Bookkeeping
        monitor._best_raw_metrics = None
        monitor._best_smooth_metrics = None
        monitor._best_epoch = None
        monitor._n_bad_epochs = 0

        # Keep track of which metrics we want to maximize / minimize
        monitor.minimize = minimize
        monitor.maximize = maximize

        # early stopping
        monitor.patience = patience
        monitor.max_epoch = max_epoch
Ejemplo n.º 2
0
    def __init__(monitor,
                 minimize=['loss'],
                 maximize=[],
                 smoothing=.6,
                 patience=None,
                 max_epoch=1000):
        monitor.ewma = util.ExpMovingAve(alpha=1 - smoothing)
        monitor.raw_metrics = []
        monitor.smooth_metrics = []
        monitor.epochs = []
        monitor.is_good = []
        # monitor.other_data = []

        # Keep track of which metrics we want to maximize / minimize
        monitor.minimize = minimize
        monitor.maximize = maximize
        # print('monitor.minimize = {!r}'.format(monitor.minimize))
        # print('monitor.maximize = {!r}'.format(monitor.maximize))

        monitor.best_raw_metrics = None
        monitor.best_smooth_metrics = None
        monitor.best_epoch = None

        # early stopping

        monitor.patience = patience
        monitor.n_bad_epochs = 0

        monitor.max_epoch = max_epoch
Ejemplo n.º 3
0
 def __setstate__(monitor, state):
     ewma_state = state.pop('ewma_state', None)
     if ewma_state is not None:
         monitor._ewma = util.ExpMovingAve()
         monitor._ewma.__dict__.update(ewma_state)
     monitor.__dict__.update(**state)