From cf7de716b6782adb4fd67362482da94290994046 Mon Sep 17 00:00:00 2001 From: jakobrunge Date: Fri, 25 Feb 2022 17:38:47 +0100 Subject: [PATCH 1/2] fixed bug in causal_effects.py --- release_on_pip.sh | 9 +++++---- tigramite/causal_effects.py | 27 +++++++++++++-------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/release_on_pip.sh b/release_on_pip.sh index e6858124..9effc710 100644 --- a/release_on_pip.sh +++ b/release_on_pip.sh @@ -15,14 +15,15 @@ # cd v4210/ # Make sure to be in a clean anaconda -# conda create --name tigramite-release-4210 python=3.7 -# conda activate tigramite-release-4210 +conda create --name tigramite-release-5001 python=3.9 +conda activate tigramite-release-5001 # Pull tigramite github -# git clone https://github.com/jakobrunge/tigramite.git +git clone https://github.com/jakobrunge/tigramite.git +cd tigramite # Checkout master -# git checkout master +git checkout master # Run all those in Linux or Windows diff --git a/tigramite/causal_effects.py b/tigramite/causal_effects.py index f92ea6cd..2063e547 100644 --- a/tigramite/causal_effects.py +++ b/tigramite/causal_effects.py @@ -73,9 +73,13 @@ def __init__(self, if S is None: S = [] - X = set(X) - Y = set(Y) - S = set(S) + self.listX = list(X) + self.listY = list(Y) + self.listS = list(S) + + self.X = set(X) + self.Y = set(Y) + self.S = set(S) # # Checks regarding graph type @@ -102,12 +106,10 @@ def __init__(self, hidden_variables = [] self.hidden_variables = set(hidden_variables) - if len(self.hidden_variables.intersection(X.union(Y).union(S))) > 0: + if len(self.hidden_variables.intersection(self.X.union(self.Y).union(self.S))) > 0: raise ValueError("XYS overlaps with hidden_variables!") - self.X = X - self.Y = Y - self.S = S + # Only needed for later extension to MAG/PAGs if 'pag' in graph_type: @@ -148,14 +150,16 @@ def __init__(self, M = set(mediators) self.M = M - for varlag in X.union(Y).union(S): + self.listM = list(self.M) + + for varlag in self.X.union(self.Y).union(self.S): if abs(varlag[1]) > self.tau_max: raise ValueError("X, Y, S must have time lags inside graph.") if len(self.X.intersection(self.Y)) > 0: raise ValueError("Overlap between X and Y") - if len(S.intersection(self.Y.union(self.X))) > 0: + if len(self.S.intersection(self.Y.union(self.X))) > 0: raise ValueError("Conditions S overlap with X or Y") # # TODO: need to prove that this is sufficient for non-identifiability! @@ -182,11 +186,6 @@ def __init__(self, if len(self.S.intersection(self._get_descendants(self.Y))) > 0: raise ValueError("Not identifiable: Conditions S overlap with des(Y)") - self.listX = list(self.X) - self.listY = list(self.Y) - self.listS = list(self.S) - self.listM = list(self.M) - if self.verbosity > 0: print("\n##\n## Initializing CausalEffects class\n##" "\n\nInput:") From 08a2695f56288dace9c348e7f480c66b2f2bc2a3 Mon Sep 17 00:00:00 2001 From: jakobrunge Date: Fri, 25 Feb 2022 17:39:02 +0100 Subject: [PATCH 2/2] fixed bug in causal_effects.py --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index c18cba0b..37b6cbcb 100644 --- a/setup.py +++ b/setup.py @@ -59,7 +59,7 @@ def run(self): # Run the setup setup( name="tigramite", - version="5.0.0.1", + version="5.0.0.2", packages=["tigramite", "tigramite.independence_tests", "tigramite.toymodels"], license="GNU General Public License v3.0", description="Tigramite causal discovery for time series",