Signed-off-by: Amit Sharma <amit_sharma@live.com>
This commit is contained in:
Amit Sharma 2024-04-14 16:36:52 +05:30 коммит произвёл Patrick Blöbaum
Родитель 100a65cf89
Коммит 2c4734867c
8 изменённых файлов: 13 добавлений и 18 удалений

Просмотреть файл

@ -103,12 +103,7 @@ class DistanceMatchingEstimator(CausalEstimator):
self.matched_indices_att = None
self.matched_indices_atc = None
def fit(
self,
data: pd.DataFrame,
effect_modifier_names: Optional[List[str]] = None,
exact_match_cols=None
):
def fit(self, data: pd.DataFrame, effect_modifier_names: Optional[List[str]] = None, exact_match_cols=None):
"""
Fits the estimator with data for effect estimation
:param data: data frame containing the data
@ -121,7 +116,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._fit_params = {"exact_match_cols": exact_match_cols}
self.reset_encoders() # Forget any existing encoders
self._set_effect_modifiers(data, effect_modifier_names)

Просмотреть файл

@ -843,7 +843,7 @@ def sensitivity_simulation(
new_estimator.fit(
new_data,
effect_modifier_names=estimate.estimator._effect_modifier_names,
**new_estimator._fit_params if hasattr(new_estimator, "_fit_params") else {}
**new_estimator._fit_params if hasattr(new_estimator, "_fit_params") else {},
)
new_effect = new_estimator.estimate_effect(
new_data,
@ -891,7 +891,7 @@ def sensitivity_simulation(
new_estimator.fit(
new_data,
effect_modifier_names=estimate.estimator._effect_modifier_names,
**new_estimator._fit_params if hasattr(new_estimator, "_fit_params") else {}
**new_estimator._fit_params if hasattr(new_estimator, "_fit_params") else {},
)
new_effect = new_estimator.estimate_effect(
new_data,
@ -967,7 +967,7 @@ def sensitivity_simulation(
new_estimator.fit(
new_data,
effect_modifier_names=estimate.estimator._effect_modifier_names,
**new_estimator._fit_params if hasattr(new_estimator, "_fit_params") else {}
**new_estimator._fit_params if hasattr(new_estimator, "_fit_params") else {},
)
new_effect = new_estimator.estimate_effect(
new_data,
@ -1025,7 +1025,7 @@ def sensitivity_simulation(
new_estimator.fit(
new_data,
effect_modifier_names=estimate.estimator._effect_modifier_names,
**new_estimator._fit_params if hasattr(new_estimator, "_fit_params") else {}
**new_estimator._fit_params if hasattr(new_estimator, "_fit_params") else {},
)
new_effect = new_estimator.estimate_effect(
new_data,

Просмотреть файл

@ -133,7 +133,7 @@ def _refute_once(
new_estimator.fit(
new_data,
effect_modifier_names=estimate.estimator._effect_modifier_names,
**new_estimator._fit_params if hasattr(new_estimator, "_fit_params") else {}
**new_estimator._fit_params if hasattr(new_estimator, "_fit_params") else {},
)
new_effect = new_estimator.estimate_effect(
new_data,

Просмотреть файл

@ -77,7 +77,7 @@ def _refute_once(
new_estimator.fit(
new_data,
effect_modifier_names=estimate.estimator._effect_modifier_names,
**new_estimator._fit_params if hasattr(new_estimator, "_fit_params") else {}
**new_estimator._fit_params if hasattr(new_estimator, "_fit_params") else {},
)
new_effect = new_estimator.estimate_effect(
new_data,

Просмотреть файл

@ -494,7 +494,7 @@ def refute_dummy_outcome(
new_estimator.fit(
new_data,
effect_modifier_names=estimate.estimator._effect_modifier_names,
**new_estimator._fit_params if hasattr(new_estimator, "_fit_params") else {}
**new_estimator._fit_params if hasattr(new_estimator, "_fit_params") else {},
)
new_effect = new_estimator.estimate_effect(
new_data,
@ -574,7 +574,7 @@ def refute_dummy_outcome(
new_estimator.fit(
new_data,
effect_modifier_names=estimate.estimator._effect_modifier_names,
**new_estimator._fit_params if hasattr(new_estimator, "_fit_params") else {}
**new_estimator._fit_params if hasattr(new_estimator, "_fit_params") else {},
)
new_effect = new_estimator.estimate_effect(
new_data,

Просмотреть файл

@ -262,7 +262,7 @@ class EValueSensitivityAnalyzer:
new_estimator.fit(
self.data,
effect_modifier_names=self.estimate.estimator._effect_modifier_names,
**new_estimator._fit_params if hasattr(new_estimator, "_fit_params") else {}
**new_estimator._fit_params if hasattr(new_estimator, "_fit_params") else {},
)
# new effect estimate

Просмотреть файл

@ -155,7 +155,7 @@ def _refute_once(
new_estimator.fit(
new_data,
effect_modifier_names=estimate.estimator._effect_modifier_names,
**new_estimator._fit_params if hasattr(new_estimator, "_fit_params") else {}
**new_estimator._fit_params if hasattr(new_estimator, "_fit_params") else {},
)
new_effect = new_estimator.estimate_effect(
new_data,

Просмотреть файл

@ -71,7 +71,7 @@ def _refute_once(
new_estimator.fit(
new_data,
effect_modifier_names=estimate.estimator._effect_modifier_names,
**new_estimator._fit_params if hasattr(new_estimator, "_fit_params") else {}
**new_estimator._fit_params if hasattr(new_estimator, "_fit_params") else {},
)
new_effect = new_estimator.estimate_effect(
new_data,