You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm trying to correct the distribution D in an original (MC) sample that already has some weights, say w_i, that correct something else (say Dp). The way I'm currently doing this is I obtain weights, say x_i, by calling predict_weights(original = D_array, original_weight = w).
My question is the following: once I've done this, do I have to use x_i or w_i * x_i as nominal weights for my MC (i.e. to have both D and Dp corrected)? If the answer is x_i, then very naively one could assume that the ratio of the two sets of corrections (x_i, w_i) would yield something that corrects Dp but not D. Is this assumption correct?
Cheers,
Dan
The text was updated successfully, but these errors were encountered:
In [2]: GBReweighter.predict_weights??
Signature: GBReweighter.predict_weights(self, original, original_weight=None)
Source:
defpredict_weights(self, original, original_weight=None):
""" Returns corrected weights. Result is computed as original_weight * reweighter_multipliers. :param original: values from original distribution of shape [n_samples, n_features] :param original_weight: weights of samples before reweighting. :return: numpy.array of shape [n_samples] with new weights. """original, original_weight=self._normalize_input(original, original_weight)
multipliers=numpy.exp(self.gb.decision_function(original))
returnmultipliers*original_weight
So multiplication is done for you (as the last line says), just use the output of this method. Note that during training of reweighter you should also provide weights that you previously used to correct Dp, then it should work as expected.
Also note that second step of correction may break corrections of the first step if you don't require reweighter to correct Dp too. In many practical situations you may not care about that if D and Dp are quite independent.
Hi, I'm trying to correct the distribution D in an original (MC) sample that already has some weights, say w_i, that correct something else (say Dp). The way I'm currently doing this is I obtain weights, say x_i, by calling
predict_weights(original = D_array, original_weight = w)
.My question is the following: once I've done this, do I have to use x_i or w_i * x_i as nominal weights for my MC (i.e. to have both D and Dp corrected)? If the answer is x_i, then very naively one could assume that the ratio of the two sets of corrections (x_i, w_i) would yield something that corrects Dp but not D. Is this assumption correct?
Cheers,
Dan
The text was updated successfully, but these errors were encountered: