'Cover and remove.
After covering a learning instance, decrease its weight and
in-turn decrease its impact on further iterations of the
algorithm.
Important
To use this function, learner parameter gamma must be set.
Weights are adjusted inplace.
Parameters
X, Y, W : ndarray
Learning data.
new_rule : Rule
Adjust learning instances covered by this rule.
Returns
X, Y, W : ndarray
Adjusted learning data.'

def weighted_cover_and_remove(self, X, Y, W, new_rule):

    examples_to_weigh = new_rule.covered_examples.copy()
    if (new_rule.target_class is not None):
        examples_to_weigh &= (Y == new_rule.target_class)
    if (W is None):
        W = np.ones(X.shape[0])
    W[examples_to_weigh] *= self.gamma
    return (X, Y, W)
