Skip to content

Commit dbc8fdb

Browse files
committed
Fixed directed info undefined and hhg
1 parent 9fffb87 commit dbc8fdb

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

pyspi/config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,12 @@
103103
MultiscaleGraphCorrelation:
104104

105105
# Hilbert-Schmidt independence criterion
106-
HSIC:
106+
HilbertSchmidtIndependenceCriterion:
107107
- biased: False
108108
- biased: True
109109

110110
# Heller-Heller-Gorfine (HHG) test
111-
HHG:
111+
HellerHellerGorfine:
112112

113113
# Multi-scale graph correlation for time series
114114
CrossMultiscaleGraphCorrelation:

pyspi/fast_config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
- biased: True
8484

8585
# Hilbert-Schmidt independence criterion
86-
HSIC:
86+
HilbertSchmidtIndependenceCriterion:
8787
- biased: False
8888
- biased: True
8989

pyspi/statistics/distance.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def multivariate(self, data):
4444
"""
4545

4646

47-
class HSIC(Undirected, Unsigned):
47+
class HilbertSchmidtIndependenceCriterion(Undirected, Unsigned):
4848
"""Hilbert-Schmidt Independence Criterion (HSIC)"""
4949

5050
name = "Hilbert-Schmidt Independence Criterion"
@@ -63,7 +63,7 @@ def bivariate(self, data, i=None, j=None):
6363
return stat
6464

6565

66-
class HHG(Directed, Unsigned):
66+
class HellerHellerGorfine(Directed, Unsigned):
6767
"""Heller-Heller-Gorfine independence criterion"""
6868

6969
name = "Heller-Heller-Gorfine Independence Criterion"

pyspi/statistics/infotheory.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -499,15 +499,16 @@ def __init__(self, n=5, **kwargs):
499499
def _compute_entropy_rates(self, targ):
500500

501501
targ = np.squeeze(targ)
502+
m_utils = jp.JPackage("infodynamics.utils").MatrixUtils
502503

503504
entropy_rate_sum = 0
504505
for i in range(1, self._n + 1):
505506
# Compute entropy for an i-dimensional embedding
506507
self._entropy_calc.initialise(i)
507508

508-
Yi = self.m_utils.makeDelayEmbeddingVector(jp.JArray(jp.JDouble, 1)(targ), i)
509+
Yi = m_utils.makeDelayEmbeddingVector(jp.JArray(jp.JDouble, 1)(targ), i)
509510
self._entropy_calc.setObservations(Yi)
510-
entropy_rate_sum = entropy_rate_sum + super(DirectedInfo, self).computeAverageLocalOfObservations() / i
511+
entropy_rate_sum = entropy_rate_sum + self._entropy_calc.computeAverageLocalOfObservations() / i
511512

512513
return entropy_rate_sum
513514

@@ -516,7 +517,7 @@ def bivariate(self, data, i=None, j=None):
516517
"""Compute directed information from i to j"""
517518

518519
entropy_rates = self._compute_entropy_rates(data.to_numpy(squeeze=True)[j])
519-
causal_entropy = self._causal_entropy.bivariate(data, i=i, j=j)
520+
causal_entropy = super().bivariate(data, i=i, j=j)
520521

521522
return entropy_rates - causal_entropy
522523

0 commit comments

Comments
 (0)