concept-collection / timeseries-compressibility
update
Jeremy Magland <jmagland@flatironinstitute.org> committed commit e395e857c9e5 parent 581f213 Browse files
2 changed files+131−0
golden.jsonadded+120−0View file
@@ -0,0 +1,120 @@
1+{
2+ "_comment": [
3+ "Cross-implementation golden numbers. Copy this file verbatim into every",
4+ "repo that implements the theory and assert agreement in that repo's test",
5+ "suite. If a port drifts, this catches it before the numbers reach a paper.",
6+ "",
7+ "Convention, stated once so it cannot be confused again:",
8+ " sigma_x std of the white input x (the model parameter)",
9+ " kernel NOT normalized (windowed-sinc designs have unit passband gain)",
10+ " sigma_y = ||h||_2 * sigma_x, the std of the signal at the quantizer",
11+ " s_star^2 = exp(int ln(S + 1/12) df) - 1/12, S(f) = sigma_x^2 |H(f)|^2",
12+ " R = G(s_star), G(s) = h(N(0,s^2) + U(-1/2,1/2)) in bits",
13+ "Quantization step is 1 throughout. Sample rate 30000 Hz where relevant.",
14+ "",
15+ "The entropy rate depends on everything only through s_star, so compare",
16+ "across implementations at matched s_star, never at matched sigma."
17+ ],
18+ "tolerance": 1e-06,
19+ "cases": [
20+ {
21+ "name": "white",
22+ "filter": {
23+ "family": "none"
24+ },
25+ "sigma_x": 5.0,
26+ "expected": {
27+ "kernel_norm": 1.0,
28+ "sigma_y": 5.0,
29+ "s_star": 5.0,
30+ "entropy_rate": 4.371424173194636,
31+ "lpc_limit": 4.373816692285584,
32+ "phase_loss": 0.0023925190909483973
33+ }
34+ },
35+ {
36+ "name": "moving-average-8",
37+ "filter": {
38+ "family": "movingAverage",
39+ "width": 8
40+ },
41+ "sigma_x": 4.0,
42+ "expected": {
43+ "kernel_norm": 0.3535533905932738,
44+ "sigma_y": 1.4142135623730951,
45+ "s_star": 0.6486418361369437,
46+ "entropy_rate": 1.5529090070448803,
47+ "lpc_limit": 1.6632170596223987,
48+ "phase_loss": 0.11030805257751841
49+ }
50+ },
51+ {
52+ "name": "first-difference",
53+ "filter": {
54+ "family": "firstDifference"
55+ },
56+ "sigma_x": 2.0,
57+ "expected": {
58+ "kernel_norm": 1.4142135623730951,
59+ "sigma_y": 2.8284271247461903,
60+ "s_star": 2.130066939377041,
61+ "entropy_rate": 3.1511229582337514,
62+ "lpc_limit": 3.1640168634505645,
63+ "phase_loss": 0.012893905216813106
64+ }
65+ },
66+ {
67+ "name": "lowpass-3k",
68+ "filter": {
69+ "family": "lowpass",
70+ "highHz": 3000,
71+ "taps": 101
72+ },
73+ "sigma_x": 8.0,
74+ "expected": {
75+ "kernel_norm": 0.4390744178171754,
76+ "sigma_y": 3.512595342537403,
77+ "s_star": 0.5040429324652645,
78+ "entropy_rate": 1.2631675560846523,
79+ "lpc_limit": 1.4216612551912078,
80+ "phase_loss": 0.15849369910655553
81+ }
82+ },
83+ {
84+ "name": "bandpass-300-6000",
85+ "filter": {
86+ "family": "bandpass",
87+ "lowHz": 300,
88+ "highHz": 6000,
89+ "taps": 101
90+ },
91+ "sigma_x": 5.0,
92+ "expected": {
93+ "kernel_norm": 0.6021585207385785,
94+ "sigma_y": 3.0107926036928925,
95+ "s_star": 0.833669837993305,
96+ "entropy_rate": 1.8663247991926637,
97+ "lpc_limit": 1.9396853252174489,
98+ "phase_loss": 0.07336052602478516
99+ }
100+ },
101+ {
102+ "name": "bandpass-300-6000-loud",
103+ "filter": {
104+ "family": "bandpass",
105+ "lowHz": 300,
106+ "highHz": 6000,
107+ "taps": 101
108+ },
109+ "sigma_x": 20.0,
110+ "expected": {
111+ "kernel_norm": 0.6021585207385785,
112+ "sigma_y": 12.04317041477157,
113+ "s_star": 1.5505778328602622,
114+ "entropy_rate": 2.7044800263187847,
115+ "lpc_limit": 2.7282484703008425,
116+ "phase_loss": 0.023768443982057796
117+ }
118+ }
119+ ]
120+}
paper/paper.mdadded+11−0View file
@@ -0,0 +1,11 @@
1+# How close are lossless codecs to the entropy rate of extracellular recordings and other noisy quantized signals?
2+
3+## Abstract
4+
5+Storage is a real cost in extracellular electrophysiology: a 512-channel probe sampled at 30 kHz produces 1.8 GB per minute, and recordings can run for hours. Compression methods are usually chosen by benchmarking candidates against one another, not by reference to theory or to any absolute limit on achievable rate. Yet most of what must be encoded is noise, which is well modeled as a stationary Gaussian process observed through a quantizer. We give a consistent Monte Carlo estimator of the model's entropy rate — the bound no lossless codec can beat — together with an analytic approximation that depends on the power spectrum alone. The fitted model predicts the rates achieved by every prediction-based codec we test to within XX bits/sample. Measured against this bound, the codecs in conventional use fall well short (XX–XX%). Linear predictive coding followed by entropy coding with Asymmetric Numeral Systems comes within 5–10% of the limit, depending on the recording setup and on the preprocessing applied before compression. We establish these results on synthetic sources as well as on three real electrophysiology recordings, raw and bandpass-filtered.
6+
7+# Introduction
8+
9+# Setup
10+
11+