Skip to content

Commit 0d0c6bf

Browse files
committed
Use a fixed seed for convergent cross mapping + infotheory SPIs.
1 parent f534a3a commit 0d0c6bf

File tree

4 files changed

+5
-2
lines changed

4 files changed

+5
-2
lines changed

pyspi/statistics/causal.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ def _from_cache(self, data):
125125
target=targname,
126126
libSizes=lib_sizes,
127127
sample=100,
128+
seed=42,
128129
)
129130
ccmf[_i, _j] = ccm_df.iloc[:, 1].values[: (nlibs + 1)]
130131
ccmf[_j, _i] = ccm_df.iloc[:, 2].values[: (nlibs + 1)]

pyspi/statistics/infotheory.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class JIDTBase(Unsigned):
3838
_TAU_SEARCH_MAX_PROP_NAME = "AUTO_EMBED_TAU_SEARCH_MAX"
3939
_BIAS_CORRECTION = "BIAS_CORRECTION"
4040
_NORMALISE = "NORMALISE"
41+
_SEED = "NOISE_SEED"
4142

4243
_base_class = jp.JPackage("infodynamics.measures.continuous")
4344

@@ -104,6 +105,7 @@ def _setup(self, calc):
104105
calc.setProperty(self._NNK_PROP_NAME, str(self._prop_k))
105106

106107
calc.setProperty(self._BIAS_CORRECTION, "false")
108+
calc.setProperty(self._SEED, "42")
107109

108110
return calc
109111

tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def pytest_sessionfinish(session, exitstatus):
3030

3131
# print problematic SPIs in table format
3232
if spi_warnings:
33-
print(f"\nDetected {len(spi_warnings)} SPI(s) with outputs exceeding the specified 2 sigma threshold.\n")
33+
print(f"\nDetected {len(spi_warnings)} SPI(s) with outputs exceeding the specified 1 sigma threshold.\n")
3434

3535
# table header
3636
print(f"{'SPI':<25}{'Cat':<10}{'Max ZSc.':>10}{'# Exceed. Pairs':>20}{'Unq. Pairs':>15}")

tests/test_SPIs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def pytest_generate_tests(metafunc):
5555

5656
def test_mpi(est, est_ob, mpi_benchmark, mpi_new, spi_warning_logger):
5757
"""Run the benchmarking tests."""
58-
zscore_threshold = 2 # 2 sigma
58+
zscore_threshold = 1 # 2 sigma
5959

6060
# separate the the mean and std. dev tables for the benchmark
6161
mean_table = mpi_benchmark['mean']

0 commit comments

Comments
 (0)