Reproducing Hazon et al. (2022) from CRCNS hc-30: IMSE fits with the paper's repetitions¶

Paper. Hazon O, Minces VH, Tomàs DP, Ganguli S, Schnitzer MJ, Jercog PE (2022). Noise correlations in neural ensemble activity limit the accuracy of hippocampal spatial representations. Nature Communications 13, 4276. doi:10.1038/s41467-022-31254-y

Dataset. CRCNS hc-30, doi:10.6080/K0GH9G5X, file hc-30/live/event_traces.mat streamed from the public S3 bucket and checked against its MD5 (version unversioned, as in the other two notebooks, whose headers give the details).

Why this notebook. The decoding notebook fits IMSE(n) = I0 n / (1 + n/N) to 4 neuron subsets per ensemble size on sizes 1, 25, 50, ... (to fit the time limit), where the paper uses 80 subsets on sizes 1, 10, 20, ... (Fig. 2e legend, "an average of over 80 randomly chosen subsets of cells"; code decode_series, d_neurons 10). The verifier of round 1 asked whether the claims built on the fitted N and I0 (saturation-ensemble-size, suppl11b-i0-vs-single-cell-snr, suppl8-task-performance-and-accuracy) fail because of the reduced repetitions. Running 80 subsets on the paper's grid for all 73 large-data sessions would take about 4 hours here, so this notebook runs it on a set of sessions chosen before any fit was seen:

  • every large-data session of Mouse2011 and Mouse2012, the two animals with the lowest per-animal N in the decoding notebook (they set the lower bound of the saturation range, and Mouse2011's mean I0 decides suppl11b);
  • the large-data session of Mouse2028, the animal with the highest per-animal N, with the fewest trials (the cost of a decoder grows with the square of the trial count; its other 14 sessions would take 10 to 15 minutes each on one process).

For each session it reproduces the decoding notebook's fit (same seeds and settings, so the same numbers) and fits again to 80 subsets on 1, 10, 20, ... and all neurons, unshuffled only (the three claims use the unshuffled fit). The claims are tested in the decoding notebook; this one shows how the fit depends on the number of subsets.

Added in the second revision, at the round-2 verifier's request. The whole entry has to run within two hours here, and the first two notebooks and the part above take about 105 minutes, so the additions are small:

  • Mouse2023, the animal that sets the upper bound of the decoding notebook's variant without misaligned sessions and degenerate fits (its one large-data session), fitted again with 40 subsets on steps of 10. Mouse2022, which sets the lower bound, is not repeated: its five sessions have 93 to 185 trials per direction, and 80 subsets on steps of 10 would take about 5 CPU hours here.
  • How N depends on the decoder: the 4-subset run repeated with C = 0.1, C = 10 and MATLAB's default loss-weighted decoding (hinge loss, C = 1) in place of voting, on 9 sessions whose events track position: the three of Mouse2012, the five of Mouse2011 with 250 neurons or fewer, and Mouse2023's.

Run time about 45 minutes on 4 CPUs.

In [1]:
import os
for _v in ("OMP_NUM_THREADS", "OPENBLAS_NUM_THREADS", "MKL_NUM_THREADS"):
    os.environ[_v] = "1"  # one thread per process; the decoders run in 4 processes
import multiprocessing as mp
import resource
import time

import numpy as np
import pandas as pd

import hc30

T0 = time.time()
sessions, md5, load_s = hc30.load_sessions()
print(f"streamed and parsed event_traces.mat in {load_s:.0f} s; md5 {md5} "
      f"({'matches' if md5 == hc30.MD5 else 'DIFFERS FROM'} checksums.md5)")

# The decoding notebook's settings, reproduced here
REPS_FULL = 10
REPS_SUB = 4
SIZES = [1] + list(range(25, 500, 25))
C_SVM = 1.0
# The paper's settings
REPS_PAPER = 80   # Fig. 2e legend
STEP_PAPER = 10   # code decode_series, default_opt d_neurons 10
# Added in the second revision (see the header)
REPS_2023 = 40   # Mouse2023
VARIANTS = [("C = 0.1", 0.1, "vote"), ("C = 10", 10.0, "vote"), ("loss-weighted", 1.0, "lossweighted")]
streamed and parsed event_traces.mat in 22 s; md5 fe0f5dd2fca6d64dbf0cd3f35e31e1f0 (matches checksums.md5)

Data check and choice of sessions¶

In [2]:
rows, TENS = [], {}
for i, s in enumerate(sessions):
    T, d, tr = hc30.session_tensor(s)
    rows.append(dict(i=i, mouse=s["mouse"], session=s["session_id"], neurons=T.shape[0],
                     right=int((d == 1).sum()), left=int((d == -1).sum())))
    TENS[i] = (T, d)
info = pd.DataFrame(rows)
info["min_trials"] = info[["right", "left"]].min(axis=1)
info["large"] = (info.neurons > 200) & (info.min_trials > 30)
print(f"sessions {len(info)}, mice {info.mouse.nunique()}, large-data sessions {int(info.large.sum())}")
low = info[info.large & info.mouse.isin(["Mouse2011", "Mouse2012"])]
high = info[info.large & (info.mouse == "Mouse2028")].nsmallest(1, "min_trials")
CHOSEN = list(low.i) + list(high.i)
EXTRA = list(info[info.large & (info.mouse == "Mouse2023")].i)
sel = info.loc[CHOSEN + EXTRA].copy()
sel["clock_err_cm"] = [hc30.clock_check(sessions[i], 0) for i in CHOSEN + EXTRA]
sel["misaligned"] = sel.clock_err_cm > 12  # as in the other notebooks
print(f"{len(CHOSEN)} sessions chosen, then {len(EXTRA)} of Mouse2023:")
print(sel[["i", "mouse", "session", "neurons", "right", "left", "clock_err_cm", "misaligned"]]
      .round(1).to_string(index=False))
TENS = {i: TENS[i] for i in CHOSEN + EXTRA}
VAR_SESSIONS = [i for i in CHOSEN + EXTRA
                if info.mouse[i] in ("Mouse2011", "Mouse2012", "Mouse2023") and not sel.misaligned[i]
                and (info.mouse[i] != "Mouse2011" or info.neurons[i] <= 250)]
print("sessions for the decoder variants:", VAR_SESSIONS)
sessions 110, mice 12, large-data sessions 73
16 sessions chosen, then 1 of Mouse2023:
 i     mouse session  neurons  right  left  clock_err_cm  misaligned
42 Mouse2012  100218      263     55    67           5.2       False
50 Mouse2012  085723      212     54    58           6.7       False
51 Mouse2012  141832      216     51    49          29.3        True
52 Mouse2012  140933      202     42    38           5.8       False
83 Mouse2011  105556      230     50    48          44.0        True
84 Mouse2011  104511      204     36    44          43.9        True
85 Mouse2011  113956      245     61    69           4.6       False
86 Mouse2011  103622      223     53    64           5.4       False
87 Mouse2011  105412      239     41    40           4.9       False
88 Mouse2011  104559      249     67    71           4.2       False
89 Mouse2011  090159      240     55    52           5.2       False
90 Mouse2011  094701      408     41    35           5.2       False
91 Mouse2011  110324      415     61    54           4.4       False
92 Mouse2011  142436      436     35    33          29.4        True
93 Mouse2011  092502      451     32    34           7.8       False
19 Mouse2028  192709      238     39    31           4.4       False
 3 Mouse2023  101329      239     50    73           5.0       False
sessions for the decoder variants: [42, 50, 52, 85, 86, 87, 88, 89, 3]
In [3]:
# Cost estimate: 2 decoders at 100 neurons per session, times the number of decoders
def plan(i):
    """Subsets and step of the second fit: the paper's, or fewer for Mouse2023 (see the header)."""
    if info.mouse[i] == "Mouse2023":
        return REPS_2023, STEP_PAPER
    return REPS_PAPER, STEP_PAPER

t_est, PER = 0, {}
rng = np.random.default_rng(0)
for i in CHOSEN + EXTRA:
    T, d = TENS[i]
    t = time.time()
    for _ in range(2):
        idx = hc30.equalize_trials(d, rng)
        sub = rng.choice(T.shape[0], 100, replace=False)
        hc30.decode_once(T[sub][:, :, idx], d[idx], rng, False, C=C_SVM)
    PER[i] = (time.time() - t) / 2
    reps, step = plan(i)
    n_sizes = len(hc30.ensemble_sizes(T.shape[0], step)) + 1
    t_est += PER[i] * (n_sizes * reps + 2 * REPS_FULL + 2 * REPS_SUB * len(SIZES))
    if i in VAR_SESSIONS:
        t_est += PER[i] * len(VARIANTS) * (REPS_FULL + REPS_SUB * len(SIZES))
print(f"estimated {t_est / 60:.0f} min on one process, about {t_est / 240:.0f} min on 4")
estimated 111 min on one process, about 28 min on 4

Decoding runs¶

In [4]:
def job(i):
    T, d = TENS[i]
    n = T.shape[0]
    # the decoding notebook's run, same seeds
    full = hc30.decode_full(T, d, seed=20000 + i, reps=REPS_FULL, C=C_SVM)
    sizes4 = [s for s in SIZES if s < n]
    iu4, _ = hc30.decode_series(T, d, seed=30000 + i, sizes=sizes4, reps=REPS_SUB, C=C_SVM)
    sizes4 = np.array(sizes4 + [n])
    imse4 = np.r_[iu4, np.mean(1 / np.array(full["mse_u"]))]
    # the paper's repetitions and grid (80 subsets at 1, 10, 20, ..., all neurons), or fewer
    reps, step = plan(i)
    sizes80 = np.array([1] + hc30.ensemble_sizes(n, step))
    imse80, _ = hc30.decode_series(T, d, seed=60000 + i, sizes=sizes80, reps=reps, C=C_SVM,
                                   shuffled=False)
    return i, sizes4, imse4, sizes80, imse80


def variant_job(i, k):
    """The decoding notebook's 4-subset run, unshuffled, with another decoder setting."""
    _, C, rule = VARIANTS[k]
    T, d = TENS[i]
    n = T.shape[0]
    sizes4 = [s for s in SIZES if s < n]
    iu4, _ = hc30.decode_series(T, d, seed=70000 + 1000 * k + i, sizes=sizes4, reps=REPS_SUB, C=C,
                                shuffled=False, decoding=rule)
    ifull, _ = hc30.decode_series(T, d, seed=75000 + 1000 * k + i, sizes=[n], reps=REPS_FULL, C=C,
                                  shuffled=False, decoding=rule)
    return i, k, np.array(sizes4 + [n]), np.r_[iu4, ifull]


def any_job(a):
    return ("main", job(a[1])) if a[0] == "main" else ("var", variant_job(a[1], a[2]))


def cost(i):
    reps, step = plan(i)
    return PER[i] * reps * len(hc30.ensemble_sizes(info.neurons[i], step))


tasks = [("main", i) for i in sorted(CHOSEN + EXTRA, key=lambda i: -cost(i))]
tasks += [("var", i, k) for i in VAR_SESSIONS for k in range(len(VARIANTS))]
t = time.time()
with mp.get_context("fork").Pool(4) as pool:
    OUT = pool.map(any_job, tasks, chunksize=1)
RUNS = {r[0]: r[1:] for kind, r in OUT if kind == "main"}
VAR = {(r[0], r[1]): r[2:] for kind, r in OUT if kind == "var"}
print(f"decoding: {(time.time() - t) / 60:.1f} min; peak memory "
      f"{resource.getrusage(resource.RUSAGE_SELF).ru_maxrss / 1e6:.1f} GB")
decoding: 42.2 min; peak memory 1.8 GB

Fits: 4 subsets on steps of 25 against 80 subsets on steps of 10¶

Fit as in the decoding notebook (hc30.fit_imse). A fit is called degenerate, as there, when N is below 0 or above 1e6.

In [5]:
fit_rows = []
for i in CHOSEN:
    s4, m4, s80, m80 = RUNS[i]
    I04, N4, I04c, N4c = hc30.fit_imse(s4, m4)
    I08, N8, I08c, N8c = hc30.fit_imse(s80, m80)
    fit_rows.append(dict(i=i, mouse=info.mouse[i], neurons=info.neurons[i],
                         misaligned=bool(sel.misaligned[i]),
                         I0_4=I04, N_4=N4, N_4_ci=N4c, I0N_4=I04 * N4,
                         I0_80=I08, N_80=N8, N_80_ci=N8c, I0N_80=I08 * N8))
FIT = pd.DataFrame(fit_rows).set_index("i")
FIT["degenerate_4"] = (FIT.N_4 < 0) | (FIT.N_4 > 1e6)
FIT["degenerate_80"] = (FIT.N_80 < 0) | (FIT.N_80 > 1e6)
pd.set_option("display.width", 160)
print(FIT[["mouse", "neurons", "misaligned", "I0_4", "N_4", "N_4_ci", "I0_80", "N_80", "N_80_ci",
           "degenerate_4", "degenerate_80"]].to_string(float_format=lambda v: f"{v:.4g}"))
print(f"degenerate fits: 4 subsets {int(FIT.degenerate_4.sum())}, 80 subsets "
      f"{int(FIT.degenerate_80.sum())} of {len(FIT)}")
ok = ~FIT.degenerate_4 & ~FIT.degenerate_80
ratio = FIT.N_80[ok] / FIT.N_4[ok]
print(f"sessions with both fits non-degenerate: {int(ok.sum())}; N(80) / N(4) median "
      f"{ratio.median():.2f}, range {ratio.min():.2f} to {ratio.max():.2f}; "
      f"I0(80) / I0(4) median {(FIT.I0_80[ok] / FIT.I0_4[ok]).median():.2f}")
print("median 95% half-interval of N relative to N: 4 subsets "
      f"{(FIT.N_4_ci / FIT.N_4.abs())[ok].median():.2f}, 80 subsets "
      f"{(FIT.N_80_ci / FIT.N_80.abs())[ok].median():.2f}")
        mouse  neurons  misaligned       I0_4       N_4    N_4_ci      I0_80      N_80   N_80_ci  degenerate_4  degenerate_80
i                                                                                                                            
42  Mouse2012      263       False  8.067e-05     458.1       199  9.126e-05     339.9      29.6         False          False
50  Mouse2012      212       False  5.257e-05       628     472.9  5.592e-05     497.8       105         False          False
51  Mouse2012      216        True  0.0005954     0.846     0.227 -0.0001194    -3.745     2.316         False           True
52  Mouse2012      202       False  0.0001132     66.74     36.33  0.0001081      72.7     11.54         False          False
83  Mouse2011      230        True      260.3 1.538e-06    0.3894      241.4 1.599e-06   0.09575         False          False
84  Mouse2011      204        True -3.662e-05    -8.951     15.19      230.6 1.694e-06   0.05544          True          False
85  Mouse2011      245       False  6.899e-05     737.6     549.9  6.581e-05      1059     363.6         False          False
86  Mouse2011      223       False   7.26e-05     283.1     111.8  6.617e-05     407.9     72.01         False          False
87  Mouse2011      239       False  4.569e-05      1083      1079  4.758e-05       723       211         False          False
88  Mouse2011      249       False  9.766e-05     554.1     507.3   9.33e-05     807.5       142         False          False
89  Mouse2011      240       False      7e-05     313.7     173.3  7.394e-05     256.9     32.17         False          False
90  Mouse2011      408       False  4.987e-05     367.3       198  4.817e-05     408.8     40.38         False          False
91  Mouse2011      415       False  7.953e-05     427.5     230.3  7.618e-05       470     80.91         False          False
92  Mouse2011      436        True   0.002343    0.2172   0.07988   0.001144    0.4389   0.08325         False          False
93  Mouse2011      451       False  3.378e-05     313.3     94.93  3.595e-05       268     24.32         False          False
19  Mouse2028      238       False  6.551e-05 1.007e+09 8.127e+14  6.487e-05 3.799e+04 3.812e+05          True          False
degenerate fits: 4 subsets 2, 80 subsets 1 of 16
sessions with both fits non-degenerate: 13; N(80) / N(4) median 1.09, range 0.67 to 2.02; I0(80) / I0(4) median 0.96
median 95% half-interval of N relative to N: 4 subsets 0.54, 80 subsets 0.18

Each session's IMSE points (1/cm^2, times 1000) against its fitted curve, for both settings (the verifier asked for a printed table of the fits).

In [6]:
def curve(n, I0, N):
    n = np.asarray(n, float)
    return I0 * n / (1 + n / N)

for i in CHOSEN:
    s4, m4, s80, m80 = RUNS[i]
    f = FIT.loc[i]
    print(f"session {i} {info.mouse[i]} {info.session[i]} ({info.neurons[i]} neurons"
          f"{', misaligned' if f.misaligned else ''})")
    for lab, s, m, I0, N in (("4 subsets ", s4, m4, f.I0_4, f.N_4), ("80 subsets", s80, m80, f.I0_80, f.N_80)):
        fit = curve(s, I0, N)
        r2 = 1 - np.sum((m - fit) ** 2) / np.sum((m - m.mean()) ** 2)
        print(f"  {lab}: N = {N:.4g}, R^2 = {r2:.3f}")
        print("    n     ", " ".join(f"{v:6d}" for v in s))
        print("    IMSE  ", " ".join(f"{1000 * v:6.2f}" for v in m))
        print("    fit   ", " ".join(f"{1000 * v:6.2f}" for v in fit))
session 42 Mouse2012 100218 (263 neurons)
  4 subsets : N = 458.1, R^2 = 0.990
    n           1     25     50     75    100    125    150    175    200    225    250    263
    IMSE     0.34   2.23   3.49   5.23   6.72   7.87   8.93   9.99  11.22  13.09  12.13  13.80
    fit      0.08   1.91   3.64   5.20   6.62   7.92   9.12  10.21  11.23  12.17  13.05  13.48
  80 subsets: N = 339.9, R^2 = 0.998
    n           1     10     20     30     40     50     60     70     80     90    100    110    120    130    140    150    160    170    180    190    200    210    220    230    240    250    260    263
    IMSE     0.49   0.99   1.71   2.45   3.13   3.74   4.51   5.18   5.91   6.42   7.00   7.59   8.19   8.69   9.11   9.55   9.92  10.71  10.96  11.03  11.56  12.06  12.24  12.25  12.68  13.01  13.47  13.42
    fit      0.09   0.89   1.72   2.52   3.27   3.98   4.65   5.30   5.91   6.49   7.05   7.58   8.09   8.58   9.05   9.50   9.93  10.34  10.74  11.12  11.49  11.85  12.19  12.52  12.84  13.15  13.44  13.53
session 50 Mouse2012 085723 (212 neurons)
  4 subsets : N = 628, R^2 = 0.988
    n           1     25     50     75    100    125    150    175    200    212
    IMSE     0.38   1.73   2.60   3.76   4.30   5.35   5.97   7.10   8.34   8.36
    fit      0.05   1.26   2.43   3.52   4.53   5.48   6.37   7.19   7.97   8.33
  80 subsets: N = 497.8, R^2 = 0.996
    n           1     10     20     30     40     50     60     70     80     90    100    110    120    130    140    150    160    170    180    190    200    210    212
    IMSE     0.43   0.83   1.27   1.63   2.07   2.46   2.90   3.34   3.87   4.32   4.65   4.98   5.43   5.96   6.03   6.52   6.64   7.24   7.10   7.73   7.97   8.43   8.28
    fit      0.06   0.55   1.08   1.58   2.07   2.54   2.99   3.43   3.85   4.26   4.66   5.04   5.41   5.76   6.11   6.45   6.77   7.09   7.39   7.69   7.98   8.26   8.31
session 51 Mouse2012 141832 (216 neurons, misaligned)
  4 subsets : N = 0.846, R^2 = 0.954
    n           1     25     50     75    100    125    150    175    200    216
    IMSE     0.28   0.47   0.47   0.49   0.51   0.50   0.50   0.51   0.53   0.52
    fit      0.27   0.49   0.50   0.50   0.50   0.50   0.50   0.50   0.50   0.50
  80 subsets: N = -3.745, R^2 = -21.853
    n           1     10     20     30     40     50     60     70     80     90    100    110    120    130    140    150    160    170    180    190    200    210    216
    IMSE     0.39   0.43   0.47   0.48   0.49   0.49   0.49   0.49   0.50   0.50   0.50   0.50   0.51   0.51   0.51   0.51   0.51   0.51   0.51   0.52   0.51   0.52   0.52
    fit     -0.16   0.71   0.55   0.51   0.49   0.48   0.48   0.47   0.47   0.47   0.46   0.46   0.46   0.46   0.46   0.46   0.46   0.46   0.46   0.46   0.46   0.46   0.45
session 52 Mouse2012 140933 (202 neurons)
  4 subsets : N = 66.74, R^2 = 0.953
    n           1     25     50     75    100    125    150    175    200    202
    IMSE     0.39   1.98   3.58   3.78   4.23   4.53   6.10   5.62   5.36   5.59
    fit      0.11   2.06   3.24   4.00   4.53   4.92   5.23   5.47   5.66   5.68
  80 subsets: N = 72.7, R^2 = 0.988
    n           1     10     20     30     40     50     60     70     80     90    100    110    120    130    140    150    160    170    180    190    200    202
    IMSE     0.43   0.99   1.63   2.10   2.51   3.04   3.61   3.97   4.19   4.34   4.66   4.84   5.22   5.18   5.33   5.26   5.52   5.68   5.50   5.49   5.49   5.56
    fit      0.11   0.95   1.70   2.30   2.79   3.20   3.55   3.86   4.12   4.35   4.55   4.73   4.89   5.04   5.17   5.29   5.40   5.51   5.60   5.68   5.76   5.78
session 83 Mouse2011 105556 (230 neurons, misaligned)
  4 subsets : N = 1.538e-06, R^2 = -0.000
    n           1     25     50     75    100    125    150    175    200    225    230
    IMSE     0.61   0.39   0.39   0.39   0.38   0.37   0.39   0.37   0.37   0.37   0.37
    fit      0.40   0.40   0.40   0.40   0.40   0.40   0.40   0.40   0.40   0.40   0.40
  80 subsets: N = 1.599e-06, R^2 = -0.000
    n           1     10     20     30     40     50     60     70     80     90    100    110    120    130    140    150    160    170    180    190    200    210    220    230
    IMSE     0.44   0.42   0.41   0.41   0.40   0.39   0.39   0.39   0.39   0.38   0.38   0.38   0.38   0.38   0.38   0.38   0.38   0.37   0.38   0.37   0.37   0.37   0.37   0.37
    fit      0.39   0.39   0.39   0.39   0.39   0.39   0.39   0.39   0.39   0.39   0.39   0.39   0.39   0.39   0.39   0.39   0.39   0.39   0.39   0.39   0.39   0.39   0.39   0.39
session 84 Mouse2011 104511 (204 neurons, misaligned)
  4 subsets : N = -8.951, R^2 = -27.473
    n           1     25     50     75    100    125    150    175    200    204
    IMSE     0.49   0.41   0.39   0.38   0.39   0.39   0.39   0.38   0.37   0.39
    fit     -0.04   0.51   0.40   0.37   0.36   0.35   0.35   0.35   0.34   0.34
  80 subsets: N = 1.694e-06, R^2 = -0.000
    n           1     10     20     30     40     50     60     70     80     90    100    110    120    130    140    150    160    170    180    190    200    204
    IMSE     0.41   0.40   0.41   0.41   0.40   0.40   0.39   0.40   0.39   0.39   0.39   0.39   0.39   0.38   0.38   0.39   0.38   0.38   0.38   0.38   0.38   0.38
    fit      0.39   0.39   0.39   0.39   0.39   0.39   0.39   0.39   0.39   0.39   0.39   0.39   0.39   0.39   0.39   0.39   0.39   0.39   0.39   0.39   0.39   0.39
session 85 Mouse2011 113956 (245 neurons)
  4 subsets : N = 737.6, R^2 = 0.989
    n           1     25     50     75    100    125    150    175    200    225    245
    IMSE     0.34   1.62   2.76   4.53   5.94   7.38   9.16   9.71  10.89  12.69  11.81
    fit      0.07   1.67   3.23   4.70   6.07   7.37   8.60   9.76  10.85  11.89  12.69
  80 subsets: N = 1059, R^2 = 0.996
    n           1     10     20     30     40     50     60     70     80     90    100    110    120    130    140    150    160    170    180    190    200    210    220    230    240    245
    IMSE     0.44   0.78   1.32   1.87   2.23   2.88   3.59   3.86   4.63   5.26   5.91   6.85   7.18   7.66   8.30   8.94   9.22   9.69  10.70  10.89  11.12  11.37  11.77  12.64  12.62  12.71
    fit      0.07   0.65   1.29   1.92   2.54   3.14   3.74   4.32   4.89   5.46   6.01   6.56   7.09   7.62   8.14   8.65   9.15   9.64  10.12  10.60  11.07  11.53  11.99  12.43  12.88  13.09
session 86 Mouse2011 103622 (223 neurons)
  4 subsets : N = 283.1, R^2 = 0.991
    n           1     25     50     75    100    125    150    175    200    223
    IMSE     0.45   1.36   2.93   4.28   5.59   6.59   7.12   7.40   8.83   8.92
    fit      0.07   1.67   3.09   4.30   5.36   6.30   7.12   7.85   8.51   9.06
  80 subsets: N = 407.9, R^2 = 0.996
    n           1     10     20     30     40     50     60     70     80     90    100    110    120    130    140    150    160    170    180    190    200    210    220    223
    IMSE     0.45   0.83   1.28   1.73   2.27   2.68   3.27   4.00   4.37   4.73   5.41   5.74   6.14   6.76   6.95   7.37   7.62   8.26   8.53   8.47   8.85   8.99   9.35   9.37
    fit      0.07   0.65   1.26   1.85   2.41   2.95   3.46   3.95   4.43   4.88   5.31   5.73   6.14   6.52   6.90   7.26   7.60   7.94   8.26   8.58   8.88   9.17   9.46   9.54
session 87 Mouse2011 105412 (239 neurons)
  4 subsets : N = 1083, R^2 = 0.989
    n           1     25     50     75    100    125    150    175    200    225    239
    IMSE     0.50   1.29   1.79   3.02   4.23   5.21   5.80   7.28   7.97   8.70   8.46
    fit      0.05   1.12   2.18   3.20   4.18   5.12   6.02   6.88   7.71   8.51   8.95
  80 subsets: N = 723, R^2 = 0.995
    n           1     10     20     30     40     50     60     70     80     90    100    110    120    130    140    150    160    170    180    190    200    210    220    230    239
    IMSE     0.46   0.72   1.13   1.41   1.76   2.08   2.46   2.89   3.29   3.65   4.11   4.37   4.88   5.28   5.83   6.02   6.33   6.76   7.04   7.39   7.42   7.76   8.03   8.17   8.21
    fit      0.05   0.47   0.93   1.37   1.80   2.23   2.64   3.04   3.43   3.81   4.18   4.54   4.90   5.24   5.58   5.91   6.23   6.55   6.86   7.16   7.45   7.74   8.03   8.30   8.55
session 88 Mouse2011 104559 (249 neurons)
  4 subsets : N = 554.1, R^2 = 0.974
    n           1     25     50     75    100    125    150    175    200    225    249
    IMSE     0.37   1.79   3.77   7.60   7.84   9.76  11.51  14.51  13.73  14.11  17.71
    fit      0.10   2.34   4.48   6.45   8.27   9.96  11.53  12.99  14.35  15.63  16.78
  80 subsets: N = 807.5, R^2 = 0.998
    n           1     10     20     30     40     50     60     70     80     90    100    110    120    130    140    150    160    170    180    190    200    210    220    230    240    249
    IMSE     0.45   1.00   1.80   2.50   3.21   4.20   5.12   5.74   6.64   7.34   8.35   9.04   9.81  10.43  11.57  12.37  12.71  13.15  13.72  14.37  14.85  15.39  16.17  16.69  16.96  17.76
    fit      0.09   0.92   1.82   2.70   3.56   4.39   5.21   6.01   6.79   7.56   8.30   9.03   9.75  10.45  11.13  11.80  12.46  13.10  13.73  14.35  14.96  15.55  16.13  16.70  17.26  17.76
session 89 Mouse2011 090159 (240 neurons)
  4 subsets : N = 313.7, R^2 = 0.981
    n           1     25     50     75    100    125    150    175    200    225    240
    IMSE     0.42   1.44   2.80   4.45   5.35   6.51   7.08   8.26   7.52   9.01  10.11
    fit      0.07   1.62   3.02   4.24   5.31   6.26   7.10   7.86   8.55   9.17   9.52
  80 subsets: N = 256.9, R^2 = 0.997
    n           1     10     20     30     40     50     60     70     80     90    100    110    120    130    140    150    160    170    180    190    200    210    220    230    240
    IMSE     0.44   0.82   1.46   1.85   2.43   2.89   3.61   3.93   4.57   4.95   5.53   5.70   6.17   6.31   6.57   7.07   7.51   7.40   7.70   8.18   8.46   8.62   8.84   9.06   8.80
    fit      0.07   0.71   1.37   1.99   2.56   3.09   3.60   4.07   4.51   4.93   5.32   5.70   6.05   6.38   6.70   7.00   7.29   7.56   7.83   8.08   8.32   8.54   8.76   8.97   9.17
session 90 Mouse2011 094701 (408 neurons)
  4 subsets : N = 367.3, R^2 = 0.951
    n           1     25     50     75    100    125    150    175    200    225    250    275    300    325    350    375    400    408
    IMSE     0.44   0.96   1.95   2.72   3.92   4.51   5.09   6.18   5.93   6.96   9.05   8.80   8.15   8.39   7.78   8.49   9.04  10.76
    fit      0.05   1.17   2.19   3.11   3.92   4.65   5.31   5.91   6.46   6.96   7.42   7.84   8.24   8.60   8.94   9.25   9.55   9.64
  80 subsets: N = 408.8, R^2 = 0.996
    n           1     10     20     30     40     50     60     70     80     90    100    110    120    130    140    150    160    170    180    190    200    210    220    230    240    250    260    270    280    290    300    310    320    330    340    350    360    370    380    390    400    408
    IMSE     0.40   0.72   1.02   1.28   1.59   1.89   2.27   2.72   2.99   3.48   3.80   3.93   4.41   4.54   4.96   5.26   5.79   5.95   6.08   6.28   6.40   6.95   7.02   7.06   7.62   7.65   7.73   7.82   8.36   8.22   8.31   8.52   8.68   9.05   8.91   9.12   9.35   9.27   9.18   9.42   9.41   9.68
    fit      0.05   0.47   0.92   1.35   1.76   2.15   2.52   2.88   3.22   3.55   3.87   4.18   4.47   4.75   5.02   5.29   5.54   5.78   6.02   6.25   6.47   6.68   6.89   7.09   7.28   7.47   7.66   7.83   8.01   8.17   8.33   8.49   8.65   8.80   8.94   9.08   9.22   9.36   9.49   9.61   9.74   9.84
session 91 Mouse2011 110324 (415 neurons)
  4 subsets : N = 427.5, R^2 = 0.959
    n           1     25     50     75    100    125    150    175    200    225    250    275    300    325    350    375    400    415
    IMSE     0.34   1.34   2.75   4.10   5.87   7.19   7.55   9.41  11.31  12.94  13.66  16.02  14.91  14.48  15.33  16.02  14.41  15.79
    fit      0.08   1.88   3.56   5.07   6.45   7.69   8.83   9.88  10.84  11.72  12.55  13.31  14.02  14.68  15.31  15.89  16.44  16.75
  80 subsets: N = 470, R^2 = 0.989
    n           1     10     20     30     40     50     60     70     80     90    100    110    120    130    140    150    160    170    180    190    200    210    220    230    240    250    260    270    280    290    300    310    320    330    340    350    360    370    380    390    400    410    415
    IMSE     0.41   0.80   1.24   1.78   2.20   2.70   3.14   3.90   4.47   5.22   5.76   6.22   6.90   7.56   8.10   8.92   8.76   9.83  10.19  11.09  10.99  11.21  11.85  12.44  12.52  12.94  13.68  14.21  13.98  13.56  14.20  14.79  14.24  14.83  15.42  14.78  15.30  15.61  15.54  15.60  15.86  15.97  16.49
    fit      0.08   0.75   1.46   2.15   2.81   3.44   4.05   4.64   5.21   5.75   6.28   6.79   7.28   7.76   8.22   8.66   9.09   9.51   9.91  10.31  10.69  11.06  11.42  11.76  12.10  12.43  12.75  13.06  13.37  13.66  13.95  14.23  14.50  14.77  15.03  15.28  15.53  15.77  16.01  16.24  16.46  16.68  16.79
session 92 Mouse2011 142436 (436 neurons, misaligned)
  4 subsets : N = 0.2172, R^2 = 0.709
    n           1     25     50     75    100    125    150    175    200    225    250    275    300    325    350    375    400    425    436
    IMSE     0.42   0.52   0.51   0.52   0.52   0.51   0.49   0.52   0.49   0.50   0.55   0.50   0.50   0.49   0.51   0.51   0.50   0.50   0.50
    fit      0.42   0.50   0.51   0.51   0.51   0.51   0.51   0.51   0.51   0.51   0.51   0.51   0.51   0.51   0.51   0.51   0.51   0.51   0.51
  80 subsets: N = 0.4389, R^2 = 0.826
    n           1     10     20     30     40     50     60     70     80     90    100    110    120    130    140    150    160    170    180    190    200    210    220    230    240    250    260    270    280    290    300    310    320    330    340    350    360    370    380    390    400    410    420    430    436
    IMSE     0.36   0.43   0.47   0.48   0.49   0.49   0.49   0.49   0.50   0.50   0.50   0.50   0.50   0.50   0.50   0.52   0.50   0.51   0.51   0.50   0.51   0.51   0.51   0.51   0.50   0.50   0.51   0.51   0.50   0.50   0.50   0.51   0.51   0.51   0.50   0.51   0.51   0.50   0.50   0.50   0.50   0.50   0.50   0.51   0.50
    fit      0.35   0.48   0.49   0.50   0.50   0.50   0.50   0.50   0.50   0.50   0.50   0.50   0.50   0.50   0.50   0.50   0.50   0.50   0.50   0.50   0.50   0.50   0.50   0.50   0.50   0.50   0.50   0.50   0.50   0.50   0.50   0.50   0.50   0.50   0.50   0.50   0.50   0.50   0.50   0.50   0.50   0.50   0.50   0.50   0.50
session 93 Mouse2011 092502 (451 neurons)
  4 subsets : N = 313.3, R^2 = 0.975
    n           1     25     50     75    100    125    150    175    200    225    250    275    300    325    350    375    400    425    450    451
    IMSE     0.54   0.96   1.66   1.79   2.08   3.16   3.78   3.73   4.16   4.36   4.56   5.19   5.04   5.45   5.54   6.33   5.58   5.66   6.58   6.16
    fit      0.03   0.78   1.46   2.04   2.56   3.02   3.43   3.79   4.12   4.42   4.70   4.95   5.18   5.39   5.58   5.77   5.94   6.09   6.24   6.25
  80 subsets: N = 268, R^2 = 0.993
    n           1     10     20     30     40     50     60     70     80     90    100    110    120    130    140    150    160    170    180    190    200    210    220    230    240    250    260    270    280    290    300    310    320    330    340    350    360    370    380    390    400    410    420    430    440    450    451
    IMSE     0.44   0.66   0.89   1.05   1.27   1.48   1.72   1.95   2.12   2.44   2.58   2.73   2.89   3.12   3.32   3.35   3.46   3.68   3.99   3.86   4.17   4.28   4.43   4.35   4.74   4.80   4.84   4.97   4.99   5.17   5.19   5.16   5.13   5.34   5.24   5.54   5.34   5.32   5.72   5.64   6.02   5.84   5.98   5.94   6.10   5.92   5.83
    fit      0.04   0.35   0.67   0.97   1.25   1.52   1.76   2.00   2.22   2.42   2.62   2.80   2.98   3.15   3.31   3.46   3.60   3.74   3.87   4.00   4.12   4.23   4.34   4.45   4.55   4.65   4.74   4.84   4.92   5.01   5.09   5.17   5.24   5.32   5.39   5.46   5.52   5.59   5.65   5.71   5.77   5.83   5.88   5.94   5.99   6.04   6.04
session 19 Mouse2028 192709 (238 neurons)
  4 subsets : N = 1.007e+09, R^2 = 0.988
    n           1     25     50     75    100    125    150    175    200    225    238
    IMSE     0.34   1.52   2.81   4.65   5.74   8.45  11.15  11.12  13.46  14.06  15.76
    fit      0.07   1.64   3.28   4.91   6.55   8.19   9.83  11.46  13.10  14.74  15.59
  80 subsets: N = 3.799e+04, R^2 = 0.997
    n           1     10     20     30     40     50     60     70     80     90    100    110    120    130    140    150    160    170    180    190    200    210    220    230    238
    IMSE     0.43   0.80   1.21   1.69   2.22   2.79   3.46   4.03   4.98   5.81   6.68   7.06   7.95   8.72   9.31   9.87  10.48  11.42  11.64  12.32  13.08  13.25  14.01  14.96  14.95
    fit      0.06   0.65   1.30   1.94   2.59   3.24   3.89   4.53   5.18   5.82   6.47   7.12   7.76   8.40   9.05   9.69  10.34  10.98  11.62  12.26  12.91  13.55  14.19  14.83  15.34

Per-animal values that the three claims use¶

saturation-ensemble-size takes the geometric mean of N over an animal's large-data sessions (N <= 0 left out, as in the decoding notebook) times sqrt(20) - 1; suppl11b takes the mean I0 over an animal's large-data sessions. Mouse2028 has only 2 of its 15 sessions here, so its value is shown for that session only.

In [7]:
def gmean(x):
    x = np.asarray(x, float)
    x = x[np.isfinite(x) & (x > 0)]
    return np.exp(np.log(x).mean())

K = np.sqrt(20) - 1
for name, sub in (("all chosen sessions", FIT), ("without misaligned sessions", FIT[~FIT.misaligned])):
    print(name)
    for m in ("Mouse2011", "Mouse2012"):
        x = sub[sub.mouse == m]
        print(f"  {m} ({len(x)} sessions): geometric-mean N, 4 subsets {gmean(x.N_4):.0f} "
              f"(5% slope at {K * gmean(x.N_4):.0f} neurons), 80 subsets {gmean(x.N_80):.0f} "
              f"(5% slope at {K * gmean(x.N_80):.0f}); mean I0, 4 subsets {x.I0_4.mean():.3g}, "
              f"80 subsets {x.I0_80.mean():.3g}")
x = FIT[FIT.mouse == "Mouse2028"]
print("Mouse2028, one session, N: 4 subsets", x.N_4.round(0).tolist(), "; 80 subsets", x.N_80.round(0).tolist())
print(f"total run time {(time.time() - T0) / 60:.1f} min")
all chosen sessions
  Mouse2011 (11 sessions): geometric-mean N, 4 subsets 30 (5% slope at 105 neurons), 80 subsets 7 (5% slope at 26); mean I0, 4 subsets 23.7, 80 subsets 42.9
  Mouse2012 (4 sessions): geometric-mean N, 4 subsets 63 (5% slope at 220 neurons), 80 subsets 231 (5% slope at 801); mean I0, 4 subsets 0.00021, 80 subsets 3.4e-05
without misaligned sessions
  Mouse2011 (8 sessions): geometric-mean N, 4 subsets 458 (5% slope at 1590 neurons), 80 subsets 490 (5% slope at 1702); mean I0, 4 subsets 6.48e-05, 80 subsets 6.34e-05
  Mouse2012 (3 sessions): geometric-mean N, 4 subsets 268 (5% slope at 930 neurons), 80 subsets 231 (5% slope at 801); mean I0, 4 subsets 8.21e-05, 80 subsets 8.51e-05
Mouse2028, one session, N: 4 subsets [1007465062.0] ; 80 subsets [37994.0]
total run time 43.2 min

Result: on these 16 sessions the fits change little with the paper's 80 subsets. On the 16 sessions, 80 subsets on steps of 10 give fewer degenerate fits (1 against 2) and narrower intervals for N (median half-interval 0.18 of N against 0.54), but for the 13 sessions with two non-degenerate fits N changes by a median factor of 1.09 (0.67 to 2.02) and I0 by 0.96. The fits that make no sense are those of sessions whose events do not track position, with either setting: sessions 83 and 84 have flat IMSE curves and give I0 = 241 and 231 with N below 1e-5 with 80 subsets, session 51 a negative N, and session 92 an N below 1. Mouse2011's mean I0 over all 11 sessions is 23.7 with 4 subsets and 42.9 with 80; without its misaligned sessions it is 6.5e-05 and 6.3e-05. Without the misaligned sessions the geometric-mean N goes from 458 to 490 (Mouse2011) and from 268 to 231 (Mouse2012), a 5% slope at 1,590 to 1,702 and 930 to 801 neurons. The one Mouse2028 session is a near-linear curve with either setting (N = 1.0e9 and 3.8e4). These sessions are all of Mouse2011 and Mouse2012 and one of Mouse2028; the animals that set the bounds of the decoding notebook's variant without misaligned sessions are Mouse2022 and Mouse2023 (below).

Mouse2023 (added in the second revision)¶

In the decoding notebook's variant without the misaligned sessions and the degenerate fits, the lowest per-animal geometric-mean N is Mouse2022's (207) and the highest Mouse2023's (716), which set the 5% slope range of 717 to 2,487 neurons. Mouse2023 has one large-data session. Its 4-subset fit below repeats the decoding notebook's (same seed), and it is fitted again with 40 subsets on steps of 10.

In [8]:
ext_rows = []
for i in EXTRA:
    s4, m4, sP, mP = RUNS[i]
    reps, step = plan(i)
    I04, N4, _, N4c = hc30.fit_imse(s4, m4)
    I0P, NP, _, NPc = hc30.fit_imse(sP, mP)
    ext_rows.append(dict(i=i, mouse=info.mouse[i], session=info.session[i], neurons=info.neurons[i],
                         min_trials=info.min_trials[i], misaligned=bool(sel.misaligned[i]),
                         subsets=f"{reps} on steps of {step}", I0_4=I04, N_4=N4, N_4_ci=N4c,
                         I0_more=I0P, N_more=NP, N_more_ci=NPc))
EXT = pd.DataFrame(ext_rows).set_index("i")
EXT["degenerate"] = (EXT.N_4 < 0) | (EXT.N_4 > 1e6) | (EXT.N_more < 0) | (EXT.N_more > 1e6)
print(EXT.to_string(float_format=lambda v: f"{v:.4g}"))
okx = ~EXT.degenerate
print(f"N(more subsets) / N(4 subsets): " + ", ".join(
    f"{i} {EXT.N_more[i] / EXT.N_4[i]:.2f}" for i in EXT.index[okx]))
for i in EXTRA:
    s4, m4, sP, mP = RUNS[i]
    print(f"session {i} {info.mouse[i]} {info.session[i]} ({info.neurons[i]} neurons)")
    for lab, s, m, I0, N in (("4 subsets   ", s4, m4, EXT.I0_4[i], EXT.N_4[i]),
                             (f"{plan(i)[0]} subsets  ", sP, mP, EXT.I0_more[i], EXT.N_more[i])):
        fit = curve(s, I0, N)
        r2 = 1 - np.sum((m - fit) ** 2) / np.sum((m - m.mean()) ** 2)
        print(f"  {lab}: N = {N:.4g}, R^2 = {r2:.3f}")
        print("    n     ", " ".join(f"{v:6d}" for v in s))
        print("    IMSE  ", " ".join(f"{1000 * v:6.2f}" for v in m))
        print("    fit   ", " ".join(f"{1000 * v:6.2f}" for v in fit))
for m in ("Mouse2023",):
    x = EXT[(EXT.mouse == m) & ~EXT.misaligned]
    x4 = x.N_4[(x.N_4 > 0) & (x.N_4 < 1e6)]
    xP = x.N_more[(x.N_more > 0) & (x.N_more < 1e6)]
    print(f"{m} ({len(x)} sessions; fits with N outside 0 to 1e6 left out, as in the variant): "
          f"geometric-mean N, 4 subsets {gmean(x4):.0f} (5% slope at {K * gmean(x4):.0f} neurons, "
          f"{len(x4)} fits), {x.subsets.iloc[0]} {gmean(xP):.0f} (5% slope at {K * gmean(xP):.0f}, "
          f"{len(xP)} fits)")
print(f"run time so far {(time.time() - T0) / 60:.1f} min")
       mouse session  neurons  min_trials  misaligned            subsets      I0_4   N_4  N_4_ci   I0_more  N_more  N_more_ci  degenerate
i                                                                                                                                        
3  Mouse2023  101329      239          50       False  40 on steps of 10 7.854e-05 716.3   940.7 8.406e-05   474.2      107.9       False
N(more subsets) / N(4 subsets): 3 0.66
session 3 Mouse2023 101329 (239 neurons)
  4 subsets   : N = 716.3, R^2 = 0.965
    n           1     25     50     75    100    125    150    175    200    225    239
    IMSE     0.42   1.90   3.66   5.04   6.12   8.97   8.98  13.37  11.33  13.21  13.97
    fit      0.08   1.90   3.67   5.33   6.89   8.36   9.74  11.05  12.28  13.45  14.08
  40 subsets  : N = 474.2, R^2 = 0.995
    n           1     10     20     30     40     50     60     70     80     90    100    110    120    130    140    150    160    170    180    190    200    210    220    230    239
    IMSE     0.41   0.91   1.47   2.24   2.76   3.40   4.37   5.05   5.72   6.32   7.07   7.45   8.25   8.71   9.27   9.39  10.20  11.41  11.18  10.97  11.68  12.50  12.05  13.15  13.15
    fit      0.08   0.82   1.61   2.37   3.10   3.80   4.48   5.13   5.75   6.36   6.94   7.51   8.05   8.58   9.09   9.58  10.06  10.52  10.97  11.40  11.82  12.23  12.63  13.02  13.36
Mouse2023 (1 sessions; fits with N outside 0 to 1e6 left out, as in the variant): geometric-mean N, 4 subsets 716 (5% slope at 2487 neurons, 1 fits), 40 on steps of 10 474 (5% slope at 1646, 1 fits)
run time so far 43.2 min

Result. Mouse2023's session gives N = 716 with 4 subsets, the decoding notebook's value, and 474 with 40 subsets on steps of 10 (R squared 0.965 and 0.995), a factor of 0.66. With 474 this animal's 5% slope point would be at 1,646 neurons in place of 2,487, still above 1,402 + 10%. Mouse2022, which sets the lower bound (717 neurons), is not repeated here.

How N depends on the decoder (added in the second revision)¶

The decoding notebook uses libsvm's L2 linear SVM with C = 1 and voting; the paper's code uses MATLAB fitcecoc with an unregularised fit and loss-weighted decoding. Here the 4-subset run is repeated with C = 0.1, C = 10, and loss-weighted decoding with the hinge loss at C = 1 (hc30.OvOLinearSVM), on the 9 sessions listed in the data check. Each is compared with the same session's 4-subset fit at C = 1 with voting, and, to show how much N moves between two runs of the same decoder, with its fit to more subsets.

In [9]:
vrows = []
for i in VAR_SESSIONS:
    base = FIT.loc[i] if i in FIT.index else EXT.loc[i].rename({"N_more": "N_80", "I0_more": "I0_80"})
    row = dict(i=i, mouse=info.mouse[i], N_vote_C1=base.N_4, N_more_subsets=base.N_80)
    for k, (lab, _, _) in enumerate(VARIANTS):
        s, m = VAR[(i, k)]
        I0, N, _, _ = hc30.fit_imse(s, m)
        row[f"N {lab}"] = N
        row[f"IMSE all {lab}"] = m[-1]
    row["IMSE all vote C1"] = RUNS[i][1][-1]
    vrows.append(row)
V = pd.DataFrame(vrows).set_index("i")
print(V.to_string(float_format=lambda v: f"{v:.4g}"))
base_ok = (V.N_vote_C1 > 0) & (V.N_vote_C1 < 1e6)
for lab, _, _ in VARIANTS:
    n = V[f"N {lab}"]
    good = (n > 0) & (n < 1e6) & base_ok
    r = n[good] / V.N_vote_C1[good]
    ri = V[f"IMSE all {lab}"] / V["IMSE all vote C1"]
    print(f"{lab}: degenerate fits {int(((n <= 0) | (n >= 1e6)).sum())} of {len(V)}; N / N(C = 1, voting) median "
          f"{r.median():.2f}, range {r.min():.2f} to {r.max():.2f}; IMSE at all neurons / C = 1 "
          f"voting median {ri.median():.2f}")
okm = base_ok & (V.N_more_subsets > 0) & (V.N_more_subsets < 1e6)
r = V.N_more_subsets[okm] / V.N_vote_C1[okm]
print(f"for comparison, more subsets against 4 at C = 1 with voting: median {r.median():.2f}, "
      f"range {r.min():.2f} to {r.max():.2f}")
for m in ("Mouse2011", "Mouse2012"):
    x = V[V.mouse == m]  # Mouse2011: the five sessions with 250 neurons or fewer
    print(f"{m} ({len(x)} sessions), geometric-mean N: C = 1 voting {gmean(x.N_vote_C1):.0f}, "
          + ", ".join(f"{lab} {gmean(x[f'N {lab}']):.0f}" for lab, _, _ in VARIANTS))
print(f"total run time {(time.time() - T0) / 60:.1f} min")
        mouse  N_vote_C1  N_more_subsets  N C = 0.1  IMSE all C = 0.1  N C = 10  IMSE all C = 10  N loss-weighted  IMSE all loss-weighted  IMSE all vote C1
i                                                                                                                                                          
42  Mouse2012      458.1           339.9      300.9           0.01362     353.2          0.01308            339.3                 0.01281            0.0138
50  Mouse2012        628           497.8      785.7           0.00818       768         0.008721            640.1                0.008373          0.008358
52  Mouse2012      66.74            72.7       90.5          0.005359     94.89         0.005621            41.57                0.004469          0.005593
85  Mouse2011      737.6            1059      537.6           0.01255     718.6          0.01335             1334                 0.01322           0.01181
86  Mouse2011      283.1           407.9      415.2          0.009335     372.9         0.009493            286.6                0.008588          0.008917
87  Mouse2011       1083             723       1893          0.009121     440.7          0.00785            316.6                0.007448          0.008456
88  Mouse2011      554.1           807.5      792.2           0.01797     949.4          0.01758            394.4                 0.01369           0.01771
89  Mouse2011      313.7           256.9      201.7          0.008883     287.4         0.008819            143.4                0.007823           0.01011
3   Mouse2023      716.3           474.2      414.4           0.01272     562.1          0.01277            215.3                 0.01145           0.01397
C = 0.1: degenerate fits 0 of 9; N / N(C = 1, voting) median 1.25, range 0.58 to 1.75; IMSE at all neurons / C = 1 voting median 0.99
C = 10: degenerate fits 0 of 9; N / N(C = 1, voting) median 0.97, range 0.41 to 1.71; IMSE at all neurons / C = 1 voting median 0.99
loss-weighted: degenerate fits 0 of 9; N / N(C = 1, voting) median 0.71, range 0.29 to 1.81; IMSE at all neurons / C = 1 voting median 0.88
for comparison, more subsets against 4 at C = 1 with voting: median 0.82, range 0.66 to 1.46
Mouse2011 (5 sessions), geometric-mean N: C = 1 voting 523, C = 0.1 583, C = 10 503, loss-weighted 369
Mouse2012 (3 sessions), geometric-mean N: C = 1 voting 268, C = 0.1 278, C = 10 295, loss-weighted 208
total run time 43.2 min

Result: N depends on the decoder by about as much as on the number of subsets, and the paper's loss-weighted decoding lowers it. On the 9 sessions, N with C = 0.1 is a median 1.25 times N with C = 1 (0.58 to 1.75), with C = 10 0.97 times (0.41 to 1.71), and with loss-weighted decoding 0.71 times (0.29 to 1.81); fitting the same decoder to more subsets moves N by a median factor of 0.82 (0.66 to 1.46). The geometric-mean N of Mouse2011's five sessions is 523 with C = 1 and voting, and 583, 503 and 369 with the three variants; of Mouse2012's three sessions 268, and 278, 295 and 208. Loss-weighted decoding also lowers the IMSE with all neurons (median factor 0.88). The saturation range was not recomputed with loss-weighted decoding, which needs the whole decoding run.

Summary¶

Result.

Claim Outcome
saturation-ensemble-size tested in the decoding notebook; this notebook checks its fit
suppl11b-i0-vs-single-cell-snr tested in the decoding notebook; this notebook checks its fit
suppl8-task-performance-and-accuracy tested in the decoding notebook; this notebook checks its fit

A failure to reproduce here may be a failure of this attempt, not of the paper: see the reasoning and the differences from the paper's method.

With the paper's 80 subsets on steps of 10, N changes by a median factor of 1.09 on the 13 sessions of Mouse2011, Mouse2012 and Mouse2028 with two non-degenerate fits, and the failed fits are those of misaligned sessions with either setting. Mouse2023's N falls from 716 to 474 with 40 subsets; Mouse2022 was not repeated. On 9 sessions the paper's loss-weighted decoding gives a median 0.71 of the N of this attempt's voting decoder. The fits on which saturation-ensemble-size and suppl8 rest therefore depend on the decoder, and the effect of the full method on those claims is not known.