clinicalml/cfrnet

weighting treated / controlled for reweight_sample option.

sanghack81 opened this issue · 1 comments

Thank you for sharing the code. I am reading through the code to understand how it works.
I am wondering whether there exists a bug in implementing "reweight_sample" option.

        if FLAGS.reweight_sample:
            w_t = t / (2 * p_t)
            w_c = (1 - t) / (2 * 1 - p_t)
            sample_weight = w_t + w_c
        else:
            sample_weight = 1.0

It looks like p_t is the proportion of treated instances -- so if it is 0.5, w_t and w_c would yield the same weight for the treated & controlled instances. If this is true, I think

w_c = (1-t)/(2*1-p_t)

should be w_c = (1 - t) / (2 * (1 - p_t))

Fixed!