Import dowhy.causal_estimators.econml locally (#713)
This imports it within the function where it's used. It removes the hard dependency on EconML and only requires it when using sensitivity_non_parametric_partial_r2. Signed-off-by: Peter Goetz <pego@amazon.com> Signed-off-by: Peter Goetz <pego@amazon.com>
This commit is contained in:
Родитель
e3f1d9b4a5
Коммит
943d4f6796
|
@ -11,7 +11,6 @@ from sklearn.linear_model import LogisticRegression
|
|||
from sklearn.preprocessing import StandardScaler
|
||||
from tqdm.auto import tqdm
|
||||
|
||||
import dowhy.causal_estimators.econml
|
||||
from dowhy.causal_estimator import CausalEstimate, CausalEstimator
|
||||
from dowhy.causal_estimators.linear_regression_estimator import LinearRegressionEstimator
|
||||
from dowhy.causal_estimators.regression_estimator import RegressionEstimator
|
||||
|
@ -672,6 +671,8 @@ def sensitivity_non_parametric_partial_r2(
|
|||
:plugin_reisz: bool: Flag on whether to use the plugin estimator or the nonparametric estimator for reisz representer function (alpha_s).
|
||||
"""
|
||||
|
||||
import dowhy.causal_estimators.econml
|
||||
|
||||
# If the estimator used is LinearDML, partially linear sensitivity analysis will be automatically chosen
|
||||
if isinstance(estimate.estimator, dowhy.causal_estimators.econml.Econml):
|
||||
if estimate.estimator._econml_methodname == "econml.dml.LinearDML":
|
||||
|
|
Загрузка…
Ссылка в новой задаче