diff --git a/doc/source/reconstruction.rst b/doc/source/reconstruction.rst index d6dc0537..8d7a37a3 100644 --- a/doc/source/reconstruction.rst +++ b/doc/source/reconstruction.rst @@ -22,6 +22,7 @@ the same general usage as above. netrd.reconstruction.CorrelationMatrix netrd.reconstruction.CorrelationSpanningTree netrd.reconstruction.FreeEnergyMinimization + netrd.reconstruction.GrangerCausality netrd.reconstruction.GraphicalLasso netrd.reconstruction.MarchenkoPastur netrd.reconstruction.MaximumLikelihoodEstimation @@ -34,7 +35,6 @@ the same general usage as above. netrd.reconstruction.PartialCorrelationMatrix netrd.reconstruction.RandomReconstructor netrd.reconstruction.ThoulessAndersonPalmer - netrd.reconstruction.TimeGrangerCausality Reference diff --git a/netrd/reconstruction/__init__.py b/netrd/reconstruction/__init__.py index 4ddfdb8c..3ce579a9 100644 --- a/netrd/reconstruction/__init__.py +++ b/netrd/reconstruction/__init__.py @@ -13,7 +13,7 @@ from .graphical_lasso import GraphicalLasso from .marchenko_pastur import MarchenkoPastur from .naive_transfer_entropy import NaiveTransferEntropy -from .time_granger_causality import TimeGrangerCausality +from .granger_causality import GrangerCausality from .optimal_causation_entropy import OptimalCausationEntropy from .correlation_spanning_tree import CorrelationSpanningTree @@ -32,7 +32,7 @@ 'GraphicalLasso', 'MarchenkoPastur', 'NaiveTransferEntropy', - 'TimeGrangerCausality', + 'GrangerCausality', 'OptimalCausationEntropy', 'CorrelationSpanningTree', ] diff --git a/netrd/reconstruction/time_granger_causality.py b/netrd/reconstruction/granger_causality.py similarity index 94% rename from netrd/reconstruction/time_granger_causality.py rename to netrd/reconstruction/granger_causality.py index 961c9f98..097222b8 100644 --- a/netrd/reconstruction/time_granger_causality.py +++ b/netrd/reconstruction/granger_causality.py @@ -1,5 +1,5 @@ """ -time_granger_causality.py +granger_causality.py -------------- Graph reconstruction algorithm based on [1]. @@ -21,7 +21,7 @@ from ..utilities import create_graph, threshold -class TimeGrangerCausality(BaseReconstructor): +class GrangerCausality(BaseReconstructor): """Uses the Granger causality between nodes.""" def fit(self, TS, lag=1, threshold_type="range", **kwargs): @@ -65,10 +65,10 @@ def fit(self, TS, lag=1, threshold_type="range", **kwargs): W = np.zeros([n, n]) for i in range(n): - xi, yi = TimeGrangerCausality.split_data(TS[i, :], lag) + xi, yi = GrangerCausality.split_data(TS[i, :], lag) for j in range(n): - xj, yj = TimeGrangerCausality.split_data(TS[j, :], lag) + xj, yj = GrangerCausality.split_data(TS[j, :], lag) xij = np.concatenate([xi, xj], axis=-1) reg1 = LinearRegression().fit(xi, yi) reg2 = LinearRegression().fit(xij, yi)