dingo-gw / dingo

Dingo: Deep inference for gravitational-wave observations
MIT License
60 stars 20 forks source link

Fixed GNPE training bug (from inference branch) #80

Closed max-dax closed 2 years ago

max-dax commented 2 years ago

After merging the inference branch, GNPE was accidentally called in inference mode. This was due to an incorrect default argument, and lead to conditioning of the inference network on t - t_hat instead of the proxy -t_hat itself:

            if not self.inference:
                # at train time, two time shifts need to be applied:
                #   1) the time shift by t for the detector projection
                #   2) the time shift by - t_hat for gnpe
                # we combine these to one shift by t - t_hat for efficiency
                extrinsic_parameters[f"{ifo_name}_time"] = t - t_hat
            else:
                # at inference time, the data is already projected onto the detector,
                # so only the gnpe time shift by - t_hat needs to be applied
                extrinsic_parameters[f"{ifo_name}_time"] = -t_hat

I fixed the bug by (i) changing the default argument and (ii) additionally explicitly setting inference=False in the train builder. The latter is only for clarity, and not required after changing the default argument.