def update(monitor, epoch, _raw_metrics, lr=None):
    """
        Informs the monitor about quality measurements for a particular epoch.

        Args:
            epoch (int):
                Current epoch number

            _raw_metrics (Dict[str, float]):
                Scalar values for each quality metric that was measured on this
                epoch.

        Returns:
            bool: improved:
                True if the model has quality of the validation metrics have
                improved.

        Example:
            >>> from netharn.monitor import *  # NOQA
            >>> import netharn as nh
            >>> rng = np.random.RandomState(0)
            >>> monitor = Monitor(minimize=['loss'], min_lr=1e-5)
            >>> for epoch in range(200):
            >>>     _raw_metrics = {'loss': rng.rand(), 'miou': rng.rand()}
            >>>     lr = 1.0 / (10 ** max(1, epoch))
            >>>     monitor.update(epoch, _raw_metrics, lr)
            >>>     term_reason = monitor.is_done()
            >>>     if term_reason:
            >>>         print('MONITOR IS DONE. BREAK')
            >>>         break
            >>> print(monitor.is_done())
            >>> assert monitor._current_lr <= monitor.min_lr
            >>> print('monitor = {!r}'.format(monitor))
        """
    monitor._epochs.append(epoch)
    monitor._raw_metrics.append(_raw_metrics)
    monitor._ewma.update(_raw_metrics)
    if epoch is not None:
        monitor._current_epoch = epoch
    if lr is not None:
        monitor._current_lr = lr
    _smooth_metrics = monitor._ewma.average()
    monitor._smooth_metrics.append(_smooth_metrics.copy())
    improved_keys = monitor._improved(_smooth_metrics, monitor.
        _best_smooth_metrics)
    if improved_keys:
        if monitor._best_smooth_metrics is None:
            monitor._best_smooth_metrics = _smooth_metrics.copy()
            monitor._best_raw_metrics = _raw_metrics.copy()
        else:
            for key in improved_keys:
                monitor._best_smooth_metrics[key] = _smooth_metrics[key]
                monitor._best_raw_metrics[key] = _raw_metrics[key]
        monitor._best_epoch = epoch
        monitor._n_bad_epochs = 0
    else:
        monitor._n_bad_epochs += 1
    improved = len(improved_keys) > 0
    monitor._is_good.append(improved)
    return improved
