* Fix issue #820 - Estimate Effect fails with Econml DML estimator Signed-off-by: Andres Morales <andresmor@microsoft.com> * Add float support to parse_state Signed-off-by: Andres Morales <andresmor@microsoft.com> --------- Signed-off-by: Andres Morales <andresmor@microsoft.com>
This commit is contained in:
Родитель
3b5989078a
Коммит
b21d2ffe06
|
@ -306,7 +306,7 @@ class Econml(CausalEstimator):
|
|||
if df is None:
|
||||
filtered_df = None
|
||||
else:
|
||||
filtered_df = df[self._effect_modifier_names].values
|
||||
filtered_df = df.values
|
||||
|
||||
for tv in self._treatment_value:
|
||||
ests.append(
|
||||
|
@ -372,7 +372,7 @@ class Econml(CausalEstimator):
|
|||
:param kwargs: passed through to estimator.effect()
|
||||
"""
|
||||
|
||||
eff = self.effect(df, *args, **kwargs).reshape((len(df), len(self._treatment_value)))
|
||||
eff = self.effect(df[self._effect_modifier_names], *args, **kwargs).reshape((len(df), len(treatment_value)))
|
||||
|
||||
out = np.zeros(len(df))
|
||||
treatment_value = parse_state(treatment_value)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
def parse_state(state):
|
||||
if type(state) in [str, int]:
|
||||
if isinstance(state, (str, int, float)):
|
||||
return [state]
|
||||
if type(state) == list:
|
||||
if isinstance(state, list):
|
||||
return state
|
||||
if type(state) == dict:
|
||||
if isinstance(state, dict):
|
||||
return [xi for xi in state.keys()]
|
||||
if not state:
|
||||
return []
|
||||
|
|
Загрузка…
Ссылка в новой задаче