Table S5#
[1]:
import scipy.stats
import numpy as np
from statsmodels.stats.multicomp import pairwise_tukeyhsd
from statsmodels.sandbox.stats.multicomp import get_tukey_pvalue
import joblib
import pandas as pd
[2]:
decoding_results = pd.read_hdf("../data/Figure5Revision.h5", data="key")
[3]:
def get_data(decoding_results, task, decoders, methods, window, modality, num_neurons):
if modality == "ca":
index = 0
elif modality == "np":
index = 1
accs = []
keys = []
for decoder, method in zip(decoders, methods):
key = f"{modality}_{method}_{window}"
if "joint" in method:
acc = np.array(decoding_results[task][decoder][key][num_neurons])[:, index]
else:
acc = np.array(decoding_results[task][decoder][key][num_neurons])
accs.append(acc)
keys.append([f"{key}_{decoder}"] * len(acc))
return np.concatenate(accs), np.concatenate(keys)
def concat_neurons(decoding_results, task, decoder, method, window, modality):
if modality == "ca":
index = 0
elif modality == "np":
index = 1
key = f"{modality}_{method}_{window}"
accs = []
for n in decoding_results[task][decoder][key].keys():
if "joint" in method:
accs.append(np.array(decoding_results[task][decoder][key][n])[:, index])
else:
accs.append(np.array(decoding_results[task][decoder][key][n]))
return np.concatenate(accs)
ANOVA for CEBRA, CEBRA-joint, baseline 33 ms (1 frame window):#
[4]:
np_total_stats = scipy.stats.f_oneway(
concat_neurons(decoding_results, "scene_annotation", "knn", "cebra", "33", "np"),
concat_neurons(
decoding_results, "scene_annotation", "knn", "cebra_joint", "33", "np"
),
concat_neurons(decoding_results, "scene_annotation", "knn", "baseline", "33", "np"),
concat_neurons(
decoding_results, "scene_annotation", "bayes", "baseline", "33", "np"
),
)
print(f"NP total stats \n {np_total_stats}")
NP total stats
F_onewayResult(statistic=15.733284888195138, pvalue=3.3055419499175817e-09)
ANOVA for CEBRA, CEBRA-joint, baseline for each neuron numbers#
[5]:
num_neurons = [10, 30, 50, 100, 200, 400, 600, 800, 900, 1000]
for i in num_neurons:
print(f"For {i} neurons from np recording (33ms, 1 frame):")
np_data, np_keys = get_data(
decoding_results,
"scene_annotation",
["knn", "knn", "knn", "bayes"],
["cebra", "cebra_joint", "baseline", "baseline"],
"33",
"np",
i,
)
stats = pairwise_tukeyhsd(np_data.flatten(), np_keys)
print(stats)
For 10 neurons from np recording (33ms, 1 frame):
Multiple Comparison of Means - Tukey HSD, FWER=0.05
=================================================================================
group1 group2 meandiff p-adj lower upper reject
---------------------------------------------------------------------------------
np_baseline_33_bayes np_baseline_33_knn -0.0231 0.7553 -0.0897 0.0435 False
np_baseline_33_bayes np_cebra_33_knn 0.0113 0.9609 -0.0552 0.0779 False
np_baseline_33_bayes np_cebra_joint_33_knn -0.0891 0.0072 -0.1557 -0.0225 True
np_baseline_33_knn np_cebra_33_knn 0.0344 0.4713 -0.0321 0.101 False
np_baseline_33_knn np_cebra_joint_33_knn -0.066 0.0524 -0.1326 0.0006 False
np_cebra_33_knn np_cebra_joint_33_knn -0.1004 0.0027 -0.167 -0.0339 True
---------------------------------------------------------------------------------
For 30 neurons from np recording (33ms, 1 frame):
Multiple Comparison of Means - Tukey HSD, FWER=0.05
================================================================================
group1 group2 meandiff p-adj lower upper reject
--------------------------------------------------------------------------------
np_baseline_33_bayes np_baseline_33_knn 0.0222 0.8323 -0.053 0.0975 False
np_baseline_33_bayes np_cebra_33_knn 0.0369 0.5155 -0.0383 0.1121 False
np_baseline_33_bayes np_cebra_joint_33_knn 0.1371 0.0004 0.0618 0.2123 True
np_baseline_33_knn np_cebra_33_knn 0.0147 0.9431 -0.0606 0.0899 False
np_baseline_33_knn np_cebra_joint_33_knn 0.1148 0.0024 0.0396 0.1901 True
np_cebra_33_knn np_cebra_joint_33_knn 0.1002 0.0076 0.0249 0.1754 True
--------------------------------------------------------------------------------
For 50 neurons from np recording (33ms, 1 frame):
Multiple Comparison of Means - Tukey HSD, FWER=0.05
================================================================================
group1 group2 meandiff p-adj lower upper reject
--------------------------------------------------------------------------------
np_baseline_33_bayes np_baseline_33_knn 0.0447 0.4575 -0.0402 0.1296 False
np_baseline_33_bayes np_cebra_33_knn 0.062 0.1986 -0.0229 0.1469 False
np_baseline_33_bayes np_cebra_joint_33_knn 0.2556 0.0 0.1706 0.3405 True
np_baseline_33_knn np_cebra_33_knn 0.0173 0.9355 -0.0676 0.1022 False
np_baseline_33_knn np_cebra_joint_33_knn 0.2109 0.0 0.126 0.2958 True
np_cebra_33_knn np_cebra_joint_33_knn 0.1936 0.0 0.1086 0.2785 True
--------------------------------------------------------------------------------
For 100 neurons from np recording (33ms, 1 frame):
Multiple Comparison of Means - Tukey HSD, FWER=0.05
================================================================================
group1 group2 meandiff p-adj lower upper reject
--------------------------------------------------------------------------------
np_baseline_33_bayes np_baseline_33_knn 0.0676 0.0207 0.0092 0.126 True
np_baseline_33_bayes np_cebra_33_knn 0.0767 0.0084 0.0183 0.1351 True
np_baseline_33_bayes np_cebra_joint_33_knn 0.3844 0.0 0.326 0.4428 True
np_baseline_33_knn np_cebra_33_knn 0.0091 0.9694 -0.0493 0.0675 False
np_baseline_33_knn np_cebra_joint_33_knn 0.3168 0.0 0.2584 0.3752 True
np_cebra_33_knn np_cebra_joint_33_knn 0.3077 0.0 0.2493 0.3661 True
--------------------------------------------------------------------------------
For 200 neurons from np recording (33ms, 1 frame):
Multiple Comparison of Means - Tukey HSD, FWER=0.05
================================================================================
group1 group2 meandiff p-adj lower upper reject
--------------------------------------------------------------------------------
np_baseline_33_bayes np_baseline_33_knn 0.1062 0.0106 0.0228 0.1896 True
np_baseline_33_bayes np_cebra_33_knn 0.1749 0.0001 0.0915 0.2583 True
np_baseline_33_bayes np_cebra_joint_33_knn 0.3932 0.0 0.3098 0.4766 True
np_baseline_33_knn np_cebra_33_knn 0.0687 0.1269 -0.0148 0.1521 False
np_baseline_33_knn np_cebra_joint_33_knn 0.287 0.0 0.2036 0.3704 True
np_cebra_33_knn np_cebra_joint_33_knn 0.2183 0.0 0.1349 0.3018 True
--------------------------------------------------------------------------------
For 400 neurons from np recording (33ms, 1 frame):
Multiple Comparison of Means - Tukey HSD, FWER=0.05
================================================================================
group1 group2 meandiff p-adj lower upper reject
--------------------------------------------------------------------------------
np_baseline_33_bayes np_baseline_33_knn 0.0747 0.0047 0.0218 0.1275 True
np_baseline_33_bayes np_cebra_33_knn 0.1111 0.0001 0.0582 0.164 True
np_baseline_33_bayes np_cebra_joint_33_knn 0.3014 0.0 0.2485 0.3543 True
np_baseline_33_knn np_cebra_33_knn 0.0364 0.239 -0.0164 0.0893 False
np_baseline_33_knn np_cebra_joint_33_knn 0.2267 0.0 0.1739 0.2796 True
np_cebra_33_knn np_cebra_joint_33_knn 0.1903 0.0 0.1374 0.2431 True
--------------------------------------------------------------------------------
For 600 neurons from np recording (33ms, 1 frame):
Multiple Comparison of Means - Tukey HSD, FWER=0.05
===============================================================================
group1 group2 meandiff p-adj lower upper reject
-------------------------------------------------------------------------------
np_baseline_33_bayes np_baseline_33_knn 0.0531 0.0013 0.0206 0.0856 True
np_baseline_33_bayes np_cebra_33_knn 0.1011 0.0 0.0686 0.1336 True
np_baseline_33_bayes np_cebra_joint_33_knn 0.2512 0.0 0.2187 0.2837 True
np_baseline_33_knn np_cebra_33_knn 0.048 0.0032 0.0155 0.0805 True
np_baseline_33_knn np_cebra_joint_33_knn 0.1981 0.0 0.1656 0.2305 True
np_cebra_33_knn np_cebra_joint_33_knn 0.1501 0.0 0.1176 0.1825 True
-------------------------------------------------------------------------------
For 800 neurons from np recording (33ms, 1 frame):
Multiple Comparison of Means - Tukey HSD, FWER=0.05
==============================================================================
group1 group2 meandiff p-adj lower upper reject
------------------------------------------------------------------------------
np_baseline_33_bayes np_baseline_33_knn 0.0553 0.0 0.0317 0.0789 True
np_baseline_33_bayes np_cebra_33_knn 0.116 0.0 0.0924 0.1396 True
np_baseline_33_bayes np_cebra_joint_33_knn 0.2303 0.0 0.2067 0.2539 True
np_baseline_33_knn np_cebra_33_knn 0.0607 0.0 0.0371 0.0843 True
np_baseline_33_knn np_cebra_joint_33_knn 0.1749 0.0 0.1513 0.1986 True
np_cebra_33_knn np_cebra_joint_33_knn 0.1143 0.0 0.0907 0.1379 True
------------------------------------------------------------------------------
For 900 neurons from np recording (33ms, 1 frame):
Multiple Comparison of Means - Tukey HSD, FWER=0.05
===============================================================================
group1 group2 meandiff p-adj lower upper reject
-------------------------------------------------------------------------------
np_baseline_33_bayes np_baseline_33_knn 0.0567 0.0062 0.0152 0.0982 True
np_baseline_33_bayes np_cebra_33_knn 0.1062 0.0 0.0647 0.1477 True
np_baseline_33_bayes np_cebra_joint_33_knn 0.2256 0.0 0.1841 0.2671 True
np_baseline_33_knn np_cebra_33_knn 0.0496 0.0168 0.0081 0.0911 True
np_baseline_33_knn np_cebra_joint_33_knn 0.1689 0.0 0.1274 0.2104 True
np_cebra_33_knn np_cebra_joint_33_knn 0.1194 0.0 0.0779 0.1609 True
-------------------------------------------------------------------------------
For 1000 neurons from np recording (33ms, 1 frame):
Multiple Comparison of Means - Tukey HSD, FWER=0.05
===============================================================================
group1 group2 meandiff p-adj lower upper reject
-------------------------------------------------------------------------------
np_baseline_33_bayes np_baseline_33_knn 0.0527 0.0002 0.0259 0.0794 True
np_baseline_33_bayes np_cebra_33_knn 0.1407 0.0 0.1139 0.1674 True
np_baseline_33_bayes np_cebra_joint_33_knn 0.2103 0.0 0.1835 0.237 True
np_baseline_33_knn np_cebra_33_knn 0.088 0.0 0.0613 0.1147 True
np_baseline_33_knn np_cebra_joint_33_knn 0.1576 0.0 0.1309 0.1844 True
np_cebra_33_knn np_cebra_joint_33_knn 0.0696 0.0 0.0429 0.0964 True
-------------------------------------------------------------------------------