PyTorch models are fit with propensity estimators regardless of weighting strategies used
Closed this issue · 2 comments
kamilest commented
Example (executed regardless of the value in the previous if-block at L174) :
CATENets/catenets/models/torch/slearner.py
Line 181 in bb4da46
This might appear in other places as well—maybe worth checking (@bcebere?)
bcebere commented
Hello @kamilest
The if-block at 174 returns self when it's done
if self._weighting_strategy is None:
# fit standard S-learner
log.info("Fit the PyTorch po_estimator")
self._po_estimator.train(X_ext, y)
return self
# use reweighting within the outcome model
log.info("Fit the PyTorch po_estimator with the propensity estimator")
self._propensity_estimator.train(X, w)
The propensity estimator is created/fitted only if self._weighting_strategy is not None.
There is a bit of spaghetti in the code, but otherwise, is this not the expected behaviour?
The PropensityNet class takes the weighting_strategy as parameter.
kamilest commented
Ah yes my bad, didn't check enough times. Thank you! 😅