fixed argument calling bug
Signed-off-by: Amit Sharma <amit_sharma@live.com>
This commit is contained in:
Родитель
f0ca30925e
Коммит
100a65cf89
|
@ -106,8 +106,8 @@ class DistanceMatchingEstimator(CausalEstimator):
|
|||
def fit(
|
||||
self,
|
||||
data: pd.DataFrame,
|
||||
exact_match_cols=None,
|
||||
effect_modifier_names: Optional[List[str]] = None,
|
||||
exact_match_cols=None
|
||||
):
|
||||
"""
|
||||
Fits the estimator with data for effect estimation
|
||||
|
@ -121,7 +121,7 @@ class DistanceMatchingEstimator(CausalEstimator):
|
|||
methods support this currently.
|
||||
"""
|
||||
self.exact_match_cols = exact_match_cols
|
||||
|
||||
self._fit_params = {'exact_match_cols': exact_match_cols}
|
||||
self.reset_encoders() # Forget any existing encoders
|
||||
self._set_effect_modifiers(data, effect_modifier_names)
|
||||
|
||||
|
|
|
@ -119,6 +119,7 @@ class Econml(CausalEstimator):
|
|||
self._set_effect_modifiers(data, effect_modifier_names)
|
||||
# Save parameters for later refutter fitting
|
||||
self._econml_fit_params = kwargs
|
||||
self._fit_params = kwargs
|
||||
|
||||
self._observed_common_causes_names = self._target_estimand.get_backdoor_variables().copy()
|
||||
|
||||
|
|
|
@ -842,8 +842,8 @@ def sensitivity_simulation(
|
|||
new_estimator = estimate.estimator.get_new_estimator_object(target_estimand)
|
||||
new_estimator.fit(
|
||||
new_data,
|
||||
estimate.estimator._effect_modifier_names,
|
||||
**new_estimator._econml_fit_params if isinstance(new_estimator, Econml) else {},
|
||||
effect_modifier_names=estimate.estimator._effect_modifier_names,
|
||||
**new_estimator._fit_params if hasattr(new_estimator, "_fit_params") else {}
|
||||
)
|
||||
new_effect = new_estimator.estimate_effect(
|
||||
new_data,
|
||||
|
@ -890,8 +890,8 @@ def sensitivity_simulation(
|
|||
new_estimator = estimate.estimator.get_new_estimator_object(target_estimand)
|
||||
new_estimator.fit(
|
||||
new_data,
|
||||
estimate.estimator._effect_modifier_names,
|
||||
**new_estimator._econml_fit_params if isinstance(new_estimator, Econml) else {},
|
||||
effect_modifier_names=estimate.estimator._effect_modifier_names,
|
||||
**new_estimator._fit_params if hasattr(new_estimator, "_fit_params") else {}
|
||||
)
|
||||
new_effect = new_estimator.estimate_effect(
|
||||
new_data,
|
||||
|
@ -966,8 +966,8 @@ def sensitivity_simulation(
|
|||
new_estimator = estimate.estimator.get_new_estimator_object(target_estimand)
|
||||
new_estimator.fit(
|
||||
new_data,
|
||||
estimate.estimator._effect_modifier_names,
|
||||
**new_estimator._econml_fit_params if isinstance(new_estimator, Econml) else {},
|
||||
effect_modifier_names=estimate.estimator._effect_modifier_names,
|
||||
**new_estimator._fit_params if hasattr(new_estimator, "_fit_params") else {}
|
||||
)
|
||||
new_effect = new_estimator.estimate_effect(
|
||||
new_data,
|
||||
|
@ -1024,8 +1024,8 @@ def sensitivity_simulation(
|
|||
new_estimator = estimate.estimator.get_new_estimator_object(target_estimand)
|
||||
new_estimator.fit(
|
||||
new_data,
|
||||
estimate.estimator._effect_modifier_names,
|
||||
**new_estimator._econml_fit_params if isinstance(new_estimator, Econml) else {},
|
||||
effect_modifier_names=estimate.estimator._effect_modifier_names,
|
||||
**new_estimator._fit_params if hasattr(new_estimator, "_fit_params") else {}
|
||||
)
|
||||
new_effect = new_estimator.estimate_effect(
|
||||
new_data,
|
||||
|
|
|
@ -132,8 +132,8 @@ def _refute_once(
|
|||
new_estimator = estimate.estimator.get_new_estimator_object(target_estimand)
|
||||
new_estimator.fit(
|
||||
new_data,
|
||||
estimate.estimator._effect_modifier_names,
|
||||
**new_estimator._econml_fit_params if isinstance(new_estimator, Econml) else {},
|
||||
effect_modifier_names=estimate.estimator._effect_modifier_names,
|
||||
**new_estimator._fit_params if hasattr(new_estimator, "_fit_params") else {}
|
||||
)
|
||||
new_effect = new_estimator.estimate_effect(
|
||||
new_data,
|
||||
|
|
|
@ -76,8 +76,8 @@ def _refute_once(
|
|||
new_estimator = estimate.estimator.get_new_estimator_object(target_estimand)
|
||||
new_estimator.fit(
|
||||
new_data,
|
||||
estimate.estimator._effect_modifier_names,
|
||||
**new_estimator._econml_fit_params if isinstance(new_estimator, Econml) else {},
|
||||
effect_modifier_names=estimate.estimator._effect_modifier_names,
|
||||
**new_estimator._fit_params if hasattr(new_estimator, "_fit_params") else {}
|
||||
)
|
||||
new_effect = new_estimator.estimate_effect(
|
||||
new_data,
|
||||
|
|
|
@ -493,8 +493,8 @@ def refute_dummy_outcome(
|
|||
new_estimator = estimate.estimator.get_new_estimator_object(identified_estimand)
|
||||
new_estimator.fit(
|
||||
new_data,
|
||||
estimate.estimator._effect_modifier_names,
|
||||
**new_estimator._econml_fit_params if isinstance(new_estimator, Econml) else {},
|
||||
effect_modifier_names=estimate.estimator._effect_modifier_names,
|
||||
**new_estimator._fit_params if hasattr(new_estimator, "_fit_params") else {}
|
||||
)
|
||||
new_effect = new_estimator.estimate_effect(
|
||||
new_data,
|
||||
|
@ -573,8 +573,8 @@ def refute_dummy_outcome(
|
|||
new_estimator = estimate.estimator.get_new_estimator_object(identified_estimand)
|
||||
new_estimator.fit(
|
||||
new_data,
|
||||
estimate.estimator._effect_modifier_names,
|
||||
**new_estimator._econml_fit_params if isinstance(new_estimator, Econml) else {},
|
||||
effect_modifier_names=estimate.estimator._effect_modifier_names,
|
||||
**new_estimator._fit_params if hasattr(new_estimator, "_fit_params") else {}
|
||||
)
|
||||
new_effect = new_estimator.estimate_effect(
|
||||
new_data,
|
||||
|
|
|
@ -261,8 +261,8 @@ class EValueSensitivityAnalyzer:
|
|||
new_estimator = self.estimate.estimator.get_new_estimator_object(new_estimand)
|
||||
new_estimator.fit(
|
||||
self.data,
|
||||
self.estimate.estimator._effect_modifier_names,
|
||||
**new_estimator._econml_fit_params if isinstance(new_estimator, Econml) else {},
|
||||
effect_modifier_names=self.estimate.estimator._effect_modifier_names,
|
||||
**new_estimator._fit_params if hasattr(new_estimator, "_fit_params") else {}
|
||||
)
|
||||
|
||||
# new effect estimate
|
||||
|
|
|
@ -154,8 +154,8 @@ def _refute_once(
|
|||
new_estimator = estimate.estimator.get_new_estimator_object(target_estimand)
|
||||
new_estimator.fit(
|
||||
new_data,
|
||||
estimate.estimator._effect_modifier_names,
|
||||
**new_estimator._econml_fit_params if isinstance(new_estimator, Econml) else {},
|
||||
effect_modifier_names=estimate.estimator._effect_modifier_names,
|
||||
**new_estimator._fit_params if hasattr(new_estimator, "_fit_params") else {}
|
||||
)
|
||||
new_effect = new_estimator.estimate_effect(
|
||||
new_data,
|
||||
|
|
|
@ -70,8 +70,8 @@ def _refute_once(
|
|||
new_estimator = estimate.estimator.get_new_estimator_object(target_estimand)
|
||||
new_estimator.fit(
|
||||
new_data,
|
||||
estimate.estimator._effect_modifier_names,
|
||||
**new_estimator._econml_fit_params if isinstance(new_estimator, Econml) else {},
|
||||
effect_modifier_names=estimate.estimator._effect_modifier_names,
|
||||
**new_estimator._fit_params if hasattr(new_estimator, "_fit_params") else {}
|
||||
)
|
||||
new_effect = new_estimator.estimate_effect(
|
||||
new_data,
|
||||
|
|
Загрузка…
Ссылка в новой задаче