py-why / dowhy

DoWhy is a Python library for causal inference that supports explicit modeling and testing of causal assumptions. DoWhy is based on a unified language for causal inference, combining causal graphical models and potential outcomes frameworks.
https://www.pywhy.org/dowhy
MIT License
6.91k stars 921 forks source link

backdoor.propensity_score_weighting - pass options to LogisticRegression #1034

Closed fraseriainlewis closed 10 months ago

fraseriainlewis commented 10 months ago

Hi, can you please advise how to pass options to LogisticRegression in backdoor.propensity_score_weighting. Specifically, I want to pass penalty='none' to LogisticRegression I tried the code below but it does not change the penalty to none - can you help? I tried kwargs but could not seem to pass this. Not sure how/where this should go in the code below.

causal_estimate_ipw = model.estimate_effect(identified_estimand, method_name="backdoor.propensity_score_weighting", target_units = "ate", method_params={"weighting_scheme":"ips_weight", "propensity_score_model":LogisticRegression(penalty='none')} )

N.b. a reason for passing penalty='none' is that using an 'l2' penalty for a logistic regression seems unusual? This is different from the behaviour of statsmodels, and I was trying to work out why dowhy was giving me different propensity scores from using statsmodels.

Version information: dowhy-0.10.1

thanks a lot!

fraseriainlewis commented 10 months ago

my fault, this does work, just needs dataset cleared before each call.