Closed abhilasha-workday closed 1 month ago
Can somebody please help me with this?
This issue is stale because it has been open for 14 days with no activity.
This issue was closed because it has been inactive for 7 days since being marked as stale.
Hello @amit-sharma ,
I am currently using DoWhy library for some causal analysis where my treatment is continuous and my outcome is binary. For estimating effect I used tow methods: Logistic regression through GLM and DML. Please find code snippets for their implementation:
Logistic Regression import statsmodels.api as sm estimate = model.estimate_effect(est_ident, method_name="backdoor.generalized_linear_model", test_significance=True, method_params = { 'num_null_simulations':20, 'num_simulations':20, 'num_quantiles_to_discretize_cont_cols':10, 'fit_method': "statsmodels", 'glm_family': sm.families.Binomial(), # logistic regression 'need_conditional_estimates':False }, control_value= 0.2, treatment_value= 0.3 ) print(estimate)
DML from sklearn.ensemble import GradientBoostingClassifier, GradientBoostingRegressor from sklearn.linear_model import LassoCV from sklearn.preprocessing import PolynomialFeatures
dml_estimate = model.estimate_effect(est_ident, method_name="backdoor.econml.dml.DML", control_value = 0.1, treatment_value = 0.2, confidence_intervals=False, method_params={"init_params":{'model_y':GradientBoostingClassifier(random_state = 101), 'model_t': GradientBoostingRegressor(random_state = 101), "model_final":LassoCV(random_state = 101), 'featurizer':PolynomialFeatures(degree=1, include_bias=True), 'discrete_treatment': False, 'random_state': 101 }, "fit_params":{}}) print(dml_estimate)
Looking forward to hearing back on this. TIA!