diff --git a/setup.py b/setup.py index 6afd3a6d..bce0d17a 100644 --- a/setup.py +++ b/setup.py @@ -63,7 +63,7 @@ def run(self): # Run the setup setup( name="tigramite", - version="5.0.1.7", + version="5.0.1.8", packages=["tigramite", "tigramite.independence_tests", "tigramite.toymodels"], license="GNU General Public License v3.0", description="Tigramite causal discovery for time series", diff --git a/tigramite/causal_effects.py b/tigramite/causal_effects.py index 5fce361b..965332e5 100644 --- a/tigramite/causal_effects.py +++ b/tigramite/causal_effects.py @@ -2367,6 +2367,9 @@ def fit_bootstrap_of(self, method, method_args, getattr(self, method)(**method_args_bootstrap) self.bootstrap_results[b] = deepcopy(self.model) + # Reset model + self.model = self.original_model + return self @@ -2552,44 +2555,42 @@ def lin_f(x): return x # print(causal_effects.get_optimal_set()) # # Fit causal effect model from observational data - causal_effects.fit_wright_effect( + causal_effects.fit_total_effect( dataframe=dataframe, # mask_type='y', - # estimator=LinearRegression(), + estimator=LinearRegression(), ) + + # # Fit causal effect model from observational data + causal_effects.fit_bootstrap_of( + method='fit_total_effect', + method_args={'dataframe':dataframe, + # mask_type='y', + 'estimator':LinearRegression() + }, + seed=4 + ) + + # Predict effect of interventions do(X=0.), ..., do(X=1.) in one go dox_vals = np.array([1.]) #np.linspace(0., 1., 1) intervention_data = dox_vals.reshape(len(dox_vals), len(X)) - pred_Y = causal_effects.predict_wright_effect( + pred_Y = causal_effects.predict_total_effect( intervention_data=intervention_data) print(pred_Y) - # # Fit causal effect model from observational data - causal_effects.fit_bootstrap_of( - method='fit_wright_effect', - method_args={'dataframe':dataframe, - # mask_type='y', - # 'estimator':LinearRegression() - } - ) # Predict effect of interventions do(X=0.), ..., do(X=1.) in one go dox_vals = np.array([1.]) #np.linspace(0., 1., 1) intervention_data = dox_vals.reshape(len(dox_vals), len(X)) conf = causal_effects.predict_bootstrap_of( - method='predict_wright_effect', + method='predict_total_effect', method_args={'intervention_data':intervention_data}) print(conf) - # # Predict effect of interventions do(X=0.), ..., do(X=1.) in one go - dox_vals = np.array([1.]) #np.linspace(0., 1., 1) - intervention_data = dox_vals.reshape(len(dox_vals), len(X)) - pred_Y = causal_effects.predict_wright_effect( - intervention_data=intervention_data) - print(pred_Y) # # Predict effect of interventions do(X=0.), ..., do(X=1.) in one go