(self, predicted_impr, actual_impr, m)
Adjust step size multiplier according to the predicted versus
        actual improvement.
Adjust step size multiplier according to the predicted versus
        actual improvement.
Adjust step size multiplier according to the predicted versus actual improvement .
def _set_new_mult(self, predicted_impr, actual_impr, m):
        """
        Adjust step size multiplier according to the predicted versus
        actual improvement.
        """
        # Model improvement as I = predicted_dI * KL + penalty * KL^2,
        # where predicted_dI = pred/KL and penalty = (act-pred)/(KL^2).
        # Optimize I w.r.t. KL: 0 = predicted_dI + 2 * penalty * KL =>
        # KL' = (-predicted_dI)/(2*penalty) = (pred/2*(pred-act)) * KL.
        # Therefore, the new multiplier is given by pred/2*(pred-act).
        new_mult = predicted_impr / (2.0 * max(1e-4,
                                               predicted_impr - actual_impr))
        new_mult = max(0.1, min(5.0, new_mult))
        new_step = max(
            min(new_mult * self.cur[m].step_mult,
                self._hyperparams['max_step_mult']),
            self._hyperparams['min_step_mult']
        )
        self.cur[m].step_mult = new_step

        if new_mult > 1:
            LOGGER.debug('Increasing step size multiplier to %f', new_step)
        else:
            LOGGER.debug('Decreasing step size multiplier to %f', new_step)
def _set_new_mult ( self , predicted_impr , actual_impr , m ) : # Model improvement as I = predicted_dI * KL + penalty * KL^2, # where predicted_dI = pred/KL and penalty = (act-pred)/(KL^2). # Optimize I w.r.t. KL: 0 = predicted_dI + 2 * penalty * KL => # KL' = (-predicted_dI)/(2*penalty) = (pred/2*(pred-act)) * KL. # Therefore, the new multiplier is given by pred/2*(pred-act). new_mult = predicted_impr / ( 2.0 * max ( 1e-4 , predicted_impr - actual_impr ) ) new_mult = max ( 0.1 , min ( 5.0 , new_mult ) ) new_step = max ( min ( new_mult * self . cur [ m ] . step_mult , self . _hyperparams [ 'max_step_mult' ] ) , self . _hyperparams [ 'min_step_mult' ] ) self . cur [ m ] . step_mult = new_step if new_mult > 1 : LOGGER . debug ( 'Increasing step size multiplier to %f' , new_step ) else : LOGGER . debug ( 'Decreasing step size multiplier to %f' , new_step )