'Args:
param: same as in :class:`HyperParamSetter`.
stat_name (str): name of the statistics.
value_func (float -> float): a function which returns a new value
taking the old value.
threshold (float): change threshold.
last_k (int): last k epochs.
reverse (bool): monitor increasing instead of decreasing.
This callback will change param by ``new_value = value_func(old_value)``, when:
``min(stats) >= stats[0] - threshold``, where
``stats = [stat_name in last k epochs]``
Example:
If validation error wasn\'t decreasing for 5 epochs, anneal the learning rate:
.. code-block:: python
StatMonitorParamSetter(\'learning_rate\', \'val-error\', lambda x: x * 0.2, 0, 5)'

def __init__(self, param, stat_name, value_func, threshold, last_k, reverse=False):

    super(StatMonitorParamSetter, self).__init__(param)
    self.stat_name = stat_name
    self.value_func = value_func
    self.last_k = last_k
    self.threshold = threshold
    self.reverse = reverse
    self.last_changed_epoch = 0
