py-why/dowhy

effect_modifiers

开放

#767 创建于 2022年11月18日

 (4 条评论) (0 个反应) (0 位负责人)Python (883 个派生)batch import
buggood first issue

仓库指标

星标
 (6,453 个星标)
PR 合并指标
 (平均合并 10天 22小时) (30 天内合并 43 个 PR)

描述

Describe the bug I'm trying to estimate the causal effect by calling the "econml" package and specified an "effect_modifiers" variables that is continuous value ,but also I want set the parameters "num_quantiles_to_discretize_cont_cols = 6"

Steps to reproduce the behavior

dml_estimate = model.estimate_effect(identified_estimand, method_name="backdoor.econml.dml.DML",
                                     control_value = 0,
                                     treatment_value = 1000,
                                     effect_modifiers=['solar_radiation'],
                                 target_units = 'ate',#lambda df: df["diffusion_conditions"]==1,  # condition used for CATE
                                 confidence_intervals=False,
                                     num_quantiles_to_discretize_cont_cols = 6,
                                method_params={"init_params":{
                                                              'model_y':GradientBoostingRegressor(),
                                                              'model_t': GradientBoostingRegressor(),
                                                              "model_final": LassoCV(fit_intercept=False),
                                                              'featurizer':PolynomialFeatures(degree=1, include_bias=True)
                                                              },
                                                "fit_params":{
                                                    'inference':BootstrapInference(n_bootstrap_samples=100, n_jobs=-1),}
                                               })

TypeError Traceback (most recent call last) ~\AppData\Local\Temp\ipykernel_3380\140799330.py in 25 }, 26 "fit_params":{ ---> 27 'inference':BootstrapInference(n_bootstrap_samples=100, n_jobs=-1),} 28 }) 29 print(dml_estimate)

TypeError: estimate_effect() got an unexpected keyword argument 'num_quantiles_to_discretize_cont_cols'

Expected behavior I really expected i would have report behavior like below: image

Version information:

  • DoWhy version [e.g. 0.7]

Additional context Add any other context about the problem here.

贡献者指南