m.mieskolainen@imperial.ac.uk, 2025
In all derivation steps here we assume that class priors are balanced (equal_frac = true),
i.e. class prior fractions are made equal by reweight.
[this strategy is set in the steering cards for configs/icezee]
In this strategy, the Stage-1 classifier weights are used as
LR-weights for the Stage-2 training. This makes Stage-2 model to learn
a conditional re-weighting model ~
Theory: Stage-2 training with Stage-1 density ratios
# Stage-1: z-marginal
r(z) = p1(z) / p0(z)
# Stage-2: (x,z)-joint with r(z) reweights for p0
p1(x,z) / (p0(x,z) x r(z)) = p1(x,z) / (p0(x|z) p1(z)) = p1(x|z) / p0(x|z),
which was obtained by utilizing the definition
Now if the final weight applied in deployment is a multiplication of the weights from the two stages as follows
Stage-1 applied Stage-2 applied
[p1(z) / p0(z)] x [p1(x|z) / p0(x|z)] = p1(x,z) / p0(x,z),
we obtain a joint ratio re-weight factor.
# Stage-1 model training
> train_runmode.reweight_param.reweight = true
> train_runmode.reweight_param.reweight_mode = 'write'
> train_runmode.reweight_param.differential = true
> train_runmode.reweight_param.equal_frac = true
> train_runmode.reweight_param.diff_param.type = 'AIRW'
> train_runmode.reweight_param.var = ['z0', 'z1', ..., 'z{m-1}']
> train_runmode.reweight_param.diff_param.AIRW_param.mode = 'LR'
# Stage-2 model training
> Train a classifier with input variables:
concat([x,z]) = ['x0', 'x1', ..., 'x{n-1}', 'z0', 'z1', ..., 'z{m-1}']
# Stage-1 model applied in evaluation
> eval_runmode.reweight_param.reweight = true
> eval_runmode.reweight_param.reweight_mode = 'load'
> eval_runmode.reweight_param.differential = true
> eval_runmode.reweight_param.equal_frac = true
> eval_runmode.reweight_param.diff_param.type = 'AIRW'
> eval_runmode.reweight_param.diff_param.AIRW_param.mode = 'LR'
# Stage-2 model applied in evaluation
> plot_param.OBS_reweight.transform_mode = 'LR'
This non-amortized strategy is somewhat different than the Type I described above.
Theory: Stage-1 and Stage-2 are simply trained to estimate the two ratios:
# Stage-1: z-marginal
p1(z) / p0(z)
# Stage-2: (x,z)-joint
p1(x,z) / p0(x,z)
without any re-weighting based on Stage-1 applied to the Stage-2 training.
Then, a deployment using the estimators as follows
Stage-1 (inverse-LR) Stage-2 applied
[p0(z) / p1(z)] x [p1(x,z) / p0(x,z)] = p1(x|z) / p0(x|z),
gives us a conditional ratio re-weight factor.
Note that the marginals
However, if
# Stage-1 model training:
> train_runmode.reweight_param.reweight = true
> train_runmode.reweight_param.reweight_mode = 'write-skip' [NOTE THIS, do not apply the weights!]
> train_runmode.reweight_param.differential = true
> train_runmode.reweight_param.equal_frac = true
> train_runmode.reweight_param.diff_param.type = 'AIRW'
> train_runmode.reweight_param.var = ['z0', 'z1', ..., 'z{m-1}']
> train_runmode.reweight_param.diff_param.AIRW_param.mode = (irrelevant because of 'write-skip')
# Stage-2 model training:
> Train a classifier with input variables:
concat([x,z]) = ['x0', 'x1', ..., 'x{n-1}', 'z0', 'z1', ..., 'z{m-1}']
# Stage-1 model applied in evaluation:
> eval_runmode.reweight_param.reweight = true
> eval_runmode.reweight_param.reweight_mode = 'load'
> eval_runmode.reweight_param.differential = true
> eval_runmode.reweight_param.equal_frac = true
> eval_runmode.reweight_param.diff_param.type = 'AIRW'
> eval_runmode.reweight_param.diff_param.AIRW_param.mode = 'inverse-LR' [NOTE THIS, apply inverse!]
# Stage-2 model applied in evaluation:
> plot_param.OBS_reweight.transform_mode = 'LR'