OSCR

Preserving predictive information under biologically plausible compression.

Code ↔ Paper

2 matches between paragraphs of the paper and lines of its authors' code, computed by the harvester (lexical-v1). Click a colored paragraph or line to see its counterpart.

The 2 matches
  1. [1] § Materials and methods › Optimization methods ↔ examplescript.m, lines 1–46 · score 0.69 · GradObj, firing rate, SQP, fmincon, MATLAB, algorithm
  2. [2] § Materials and methods › Coarse-graining functions ↔ figscript.m, lines 986–1055 · score 0.51 · maximally correlated cells, simulate, meta neuron, summed, activity, movies

Paper

Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC

The paper is loaded when this pane is shown.

The authors' code

MATLAB · 286 lines · 8.9 KB · no license · 1 match

  1. %% example script to optimize PCG
  2. % Requires MATLAB R2016b or later (local functions in scripts)
  3. % set up and preprocessing
  4. load('multmovie_data.mat');
  5. ntrials = min(nreps); ptrials = round(ntrials*0.5); nsamp = 50; % for bootstrapping
  6. rng(0); N = 4; cutoff = 20;
  7. load("maxpredgroupsall.mat"); % create mixed group of ranked pred cells and overlapping groups
  8. maxpredgroups = reshape(maxpredgroupsall(1:92),N,[]); maxpredgroups = maxpredgroups';
  9. y = randsample(maxpredgroupsall(1:cutoff),N*30,true); randgroups1 = reshape(y,[],N);
  10. y = randsample(ncell,N*20,true); randgroups2 = reshape(y,[],N);
  11. maxpredgroups = [maxpredgroups; randgroups1; randgroups2];
  12. ngroups = size(maxpredgroups,1);
  13. % optimize PCG with firing rate constraint
  14. Dt = 1; nrun = 50;
  15. mov = 4; % fish movie
  16. binned = binned(1:nreps(mov),:,:,mov); % in ntrials x trialtime x ncells x movie. binned in binary
  17. binned = permute(binned,[3,2,1]);
  18. binned = reshape(binned,ncell,[]);
  19. [I_wordword,I_CCG,R_CCG,I_PCG,R_PCG,Params,Bootstrap_CCG,Bootstrap_PCG] = preallocate(maxpredgroups,nsamp);
  20. for i = 1:ngroups
  21. mycells = maxpredgroups(i,:);
  22. [I_CCG(i),R_CCG(i),I_wordword(i)] = CCGInfo(mycells,binned,Dt);
  23. fr = R_CCG(i);
  24. fun = @(params)PerceptronInfo(mycells,binned,params,Dt);
  25. con = @(params)mycon(mycells,binned,params,fr);
  26. paramsrun = nan(nrun,N+1); fvalrun = nan(1,nrun); Rrun = nan(1,nrun);
  27. for run = 1:nrun
  28. params0 = 100.*rand(1,N+1);
  29. [params,fval] = fmincon(fun,params0,[]...
  30. ,[],[],[],zeros(1,N+1),100.*ones(1,N+1),con,optimset('GradObj','off','Algorithm','sqp','Display','off'));
  31. paramsrun(run,:) = params; fvalrun(run) = fval; Rrun(run) = PerceptronFR(mycells,binned,params);
  32. end
  33. [fval,runidx] = min(fvalrun); params = paramsrun(runidx,:);
  34. I_PCG(i) = -fval; Params(:,i) = params; R_PCG(i) = Rrun(runidx);
  35. for j = 1:nsamp
  36. allptrials = randsample(ntrials,ptrials);
  37. Bootstrap_CCG(i,j) = LMInfosample(mycells,allptrials,Dt,mov);
  38. Bootstrap_PCG(i,j) = PerceptronInfosample(mycells,allptrials,params,Dt,mov);
  39. end
  40. end
  41. err_CCG = std(Bootstrap_CCG,0,2)./sqrt(2);
  42. err_PCG = std(Bootstrap_PCG,0,2)./sqrt(2);
  43. function [I_wordword,I_CCG,R_CCG,I_PCG,R_PCG,Params,Bootstrap_CCG,Bootstrap_PCG] = preallocate(groups,nsamp)
  44. % PREALLOCATE sets up and preallocates vectors
  45. ngroups = size(groups,1); N = size(groups,2);
  46. I_wordword = nan(1,ngroups); I_CCG = nan(1,ngroups); R_CCG = nan(1,ngroups);
  47. I_PCG = nan(1,ngroups); R_PCG = nan(1,ngroups); Params = nan(N+1,ngroups);
  48. Bootstrap_CCG = nan(ngroups,nsamp); Bootstrap_PCG = nan(ngroups,nsamp);
  49. end
  50. function [P_wt,condprob] = CondProb(mycells,binned,Dt)
  51. %CONDPROB gets the probability of words wt and the conditional probability
  52. % matrix for every wt+dt given wt
  53. % Dt = # time steps in future
  54. N=length(mycells);
  55. binnedspikes = binned(mycells,:);
  56. % first find all zero words
  57. idx0 = sum(binnedspikes,1)==0;
  58. % where this is true, we want binnedwords to be 1 anyway
  59. % where it is false (0), we want to replace it with the correct word
  60. binnedwords = double(idx0);
  61. idx1 = find(idx0==0);
  62. for i = 1:length(idx1)
  63. a = num2str(binnedspikes(:,idx1(i)));
  64. a = sprintf(a);
  65. binnedwords(idx1(i)) = bin2dec(a)+1;
  66. end
  67. presbinnedwords = binnedwords(1:end-Dt);
  68. futbinnedwords = binnedwords(Dt+1:end);
  69. jointwords = (futbinnedwords-1).*2^N+presbinnedwords;
  70. N_wt = histcounts(binnedwords,1:2^N+1)';
  71. A = histcounts(jointwords,1:2^(2*N)+1)';
  72. A = reshape(A,2^N,[]);
  73. condprob = A./sum(A,2,'omitnan');
  74. % word entropy
  75. condprob = condprob./sum(condprob,2,'omitnan');
  76. P_wt = N_wt/sum(N_wt);
  77. end
  78. function [I] = WordInfo(P_wt,condprob)
  79. %WORDINFO gets the mutual information between words at time t and words at
  80. % t+dt, normalized by mean number of spikes
  81. H1 = -sum(P_wt.*log2(P_wt),'omitnan');
  82. H2 = -sum(P_wt.*condprob.*log2(condprob),'all','omitnan');
  83. I = H1-H2;
  84. end
  85. function [I_CCG,R_CCG,I_wordword,cg_spks] = CCGInfo(mycells,binned,Dt)
  86. %CCGINFO gets I(Mt;sigmat+dt)
  87. N=length(mycells);
  88. nword=2^N;
  89. binnedspikes = binned(mycells,:);
  90. % first find all zero words
  91. idx0 = sum(binnedspikes,1)==0;
  92. % where this is true, we want binnedwords to be 1 anyway
  93. % where it is false (0), we want to replace it with the correct word
  94. binnedwords = double(idx0);
  95. idx1 = find(idx0==0);
  96. for i = 1:length(idx1)
  97. a = num2str(binnedspikes(:,idx1(i)));
  98. a = sprintf(a);
  99. binnedwords(idx1(i)) = bin2dec(a)+1;
  100. end
  101. presbinnedwords = binnedwords(1:end-Dt);
  102. futbinnedwords = binnedwords(Dt+1:end);
  103. jointwords = (futbinnedwords-1).*2^N+presbinnedwords;
  104. N_wt = histcounts(binnedwords,1:2^N+1)';
  105. A = histcounts(jointwords,1:2^(2*N)+1)';
  106. A = reshape(A,2^N,[]);
  107. condprob = A./sum(A,2,'omitnan');
  108. condprob1 = condprob./sum(condprob,2,'omitnan');
  109. P_wt = N_wt/sum(N_wt);
  110. % get word-word info
  111. I_wordword = WordInfo(P_wt,condprob1);
  112. % now get cond prob of meta given word
  113. nstep = floor(log2(N)); % number of coarse-graining steps
  114. spks = binnedspikes;
  115. for i = 1:nstep
  116. R = corrcoef(spks');
  117. R(eye(size(R))==1) = nan;
  118. npairs = floor(N/(2^i)); % number of coarse-grained pairs in this step
  119. g = nan(npairs,2);
  120. % find correlated pairs
  121. if npairs ==1
  122. [row,col] = find(R==max(R,[],'all'));
  123. if length(row)>2
  124. row = [row(1) row(3)]; % if two pairs have same max corr, pick 1st pair
  125. col = [row(2) row(1)];
  126. end
  127. g(1,:) = row; % next pair of maximally correlated cells
  128. % g(1,:) = [1 2];
  129. else
  130. for l = 1:npairs
  131. [row,col] = find(R==max(R,[],'all'));
  132. if length(row)>2
  133. row = [row(1) row(3)]; % if two pairs have same max corr, pick 1st pair
  134. col = [row(2) row(1)];
  135. end
  136. g(l,:) = row; % next pair of maximally correlated cells
  137. R(row,:) = nan; R(:,col) = nan;
  138. end
  139. end
  140. % sum spike train pairs
  141. cg_spks = zeros(npairs,size(binned,2));
  142. for l = 1:npairs
  143. cg_spks(l,:) = sum(spks(g(l,:),:),1);
  144. end
  145. cg_spks = cg_spks./max(cg_spks,[],2);
  146. spks = cg_spks; % update
  147. end
  148. condhold = zeros(nword,1);
  149. % use final cg_spks to find P(Mt|wt)
  150. for k = 1:nword % w_t
  151. % find all indices of words(k), count
  152. idx = find(binnedwords==k);
  153. idx = idx(idx<size(binned,2));
  154. % final coarsegraining gives probility of meta neuron spiking
  155. probM = spks(idx);
  156. condhold(k) = mean(probM,'omitnan');
  157. end
  158. condprob2 = [1-condhold condhold];
  159. Joint = zeros(nword,2);
  160. for m = 1:2
  161. for j = 1:nword
  162. Joint(j,m) = sum(condprob1(:,j).*condprob2(:,m).*P_wt,'omitnan');
  163. end
  164. end
  165. Joint = Joint./sum(Joint,'all');
  166. P_Mt = sum(Joint,1);
  167. P_wt = sum(Joint,2);
  168. % calculate mutual info
  169. I_CCG = -sum(P_Mt.*log2(P_Mt),'omitnan')-sum(P_wt.*log2(P_wt),'omitnan')+sum(Joint.*log2(Joint),'all','omitnan');
  170. R_CCG = P_Mt(2);
  171. end
  172. function [I] = PerceptronInfo(mycells,binned,params,Dt)
  173. %PerceptronInfo gets the mutual information between perceptron at time t and words at
  174. % t+dt
  175. N=length(mycells);
  176. % find all 2^N possible "words"
  177. nword=2^N;
  178. vec = 0:nword-1;
  179. words=dec2bin(vec);
  180. words=double(reshape(logical(words(:)-'0'),nword,[]));
  181. words = words.';
  182. [~, wordorder] = sort(sum(words,1));
  183. words = words(:,wordorder);
  184. % first get word probability P_wt
  185. [P_wt,condprob1] = CondProb(mycells,binned,Dt);
  186. condprob1 = condprob1./sum(condprob1,2);
  187. w = params(1:N);
  188. c = params(N+1);
  189. condprob2 = zeros(nword,2); % matrix of word counts, rows = wt, col = Mt
  190. % now get cond prob of meta given word
  191. for k = 1:nword
  192. wt = words(:,k);
  193. z = sum(wt'.*w);
  194. condprob2(k,2) = (1./(1+exp(-z+c)));
  195. condprob2(k,1) = 1-condprob2(k,2);
  196. end
  197. Joint = zeros(nword,2);
  198. for m = 1:2
  199. for j = 1:nword
  200. Joint(j,m) = sum(condprob1(:,j).*condprob2(:,m).*P_wt,'omitnan');
  201. end
  202. end
  203. Joint = Joint./sum(Joint,'all');
  204. P_Mt = sum(Joint,1);
  205. P_wt = sum(Joint,2);
  206. % calculate mutual info
  207. I = -sum(P_Mt.*log2(P_Mt),'omitnan')-sum(P_wt.*log2(P_wt),'omitnan')+sum(Joint.*log2(Joint),'all','omitnan');
  208. I = -I; % return negative info
  209. end
  210. function [R_PCG] = PerceptronFR(mycells,binned,params)
  211. N=length(mycells);
  212. nword = 2^N;
  213. vec = 0:nword-1;
  214. words=dec2bin(vec);
  215. words=double(reshape(logical(words(:)-'0'),nword,[]));
  216. words = words.';
  217. [~, wordorder] = sort(sum(words,1));
  218. words = words(:,wordorder);
  219. binnedspikes = binned(mycells,:);
  220. % first find all zero words
  221. idx0 = sum(binnedspikes,1)==0;
  222. % where this is true, we want binnedwords to be 1 anyway
  223. % where it is false (0), we want to replace it with the correct word
  224. binnedwords = double(idx0);
  225. idx1 = find(idx0==0);
  226. for i = 1:length(idx1)
  227. a = num2str(binnedspikes(:,idx1(i)));
  228. a = sprintf(a);
  229. binnedwords(idx1(i)) = bin2dec(a)+1;
  230. end
  231. N_wt = histcounts(binnedwords,1:2^N+1)';
  232. P_wt = N_wt/sum(N_wt);
  233. nword = round(nword);
  234. spkproball = zeros(1,nword);
  235. w = params(1:N);
  236. c1 = params(N+1);
  237. for k = 1:nword
  238. wt = words(:,k);
  239. z = sum(wt'.*w);
  240. probM = 1./(1+exp(-z+c1));
  241. spkproball(k) = probM.*P_wt(k);
  242. end
  243. R_PCG = sum(spkproball);
  244. end
  245. function [c,ceq] = mycon(mycells,binned,params,fr)
  246. R_PCG = PerceptronFR(mycells,binned,params);
  247. tol = 1e-4;
  248. c = (R_PCG-fr)^2-tol;
  249. ceq = [];
  250. end

examplescript.m at commit 708aa67, no license · at the source

Overview

  1. Department of Organismal Biology and Anatomy, University of Chicago, Chicago, IL 60637, USA
  2. Institut de la Vision, Sorbonne Université, INSERM, CNRS, Paris 75012, France
  3. Physics Frontier Center for Living Systems, University of Chicago, Chicago, IL 60637, USA
Journal: PNAS nexus, volume 5, issue 7, article pgag224
Dates: received 7 October 2025; accepted 4 June 2026; published online 19 June 2026
Type: Research article · Language: English
License: CC BY-NC
Identifiers: DOI 10.1093/pnasnexus/pgag224 · PMID 42403907 · PMCID PMC13329666 · OpenAlex W4408392230
Open access: gold, a free copy (OpenAlex)
Status: code verified
Methods: Statistics, Smoothing, state filtering, decompositions, Connectivity, Single-unit activity, calcium imaging
Keywords: prediction, information theory, natural scenes, population coding, downstream readout
Topic: Neural Networks and Applications (Artificial Intelligence, Computer Science), according to OpenAlex
Funding: National Science Foundation (2235451); Simons Foundation (MP-TMPS- 00005320)
Citations: cited by 1 paper (Europe PMC); 99 references in the paper

Abstract

Retinal ganglion cells show high convergence onto their downstream projections, which poses a problem for information transfer: how can information be preserved through a synaptic layer that has significantly more inputs than outputs? Lossy compression suggests many efficient, yet computation-agnostic, methods for reading out input stimuli or activity patterns. Focusing on prediction as a ubiquitous computation in the brain, we compare compressions that explicitly retain predictive information to common neural compression frameworks that do not. We find evidence that compressing retinal inputs to perform optimal predictive computations allows putative downstream neurons to predict the future near-optimally across natural scenes. Other sensory systems also exhibit compression in their processing hierarchies, and we hope that our framework will be useful in cases where it is not yet known how information about a specific computation is maintained under compression.

Reproduced under the paper's license (CC BY-NC), from the paper cited above.

Repository

Its files are read in the Code ↔ Paper reader above, with 2 matches between paragraphs and lines of code.

sepalmer/predictive-coarse-graining

License: none: the authors keep all their rights
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Commit: 708aa67321388895b0de567ea84ef9b79eff3959, 11 February 2026
Languages: MATLAB (2)
Size: 39 files, 2 scripts
Software Heritage: not archived
Found in: “Data availability”
Holds: README
Not found: license file, CITATION.cff, environment file, tests, continuous integration, documentation
Availability: 1 check, the latest on 27 September 2026: the link answers
  • 27 September 2026: the link answers
3 files

The paper's code and data availability statement is in the Data section.

Tracing map

Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.

What the map holds:

  • 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 2 scripts, each with its path and the digest of its content;
  • 2 matches between paragraphs of the paper and lines of the code (method lexical-v1);
  • neither the text of the paper nor the code itself.

Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.

Data

Datasets cited

Data availability

The data have been published at https://doi.org/10.5061/dryad.4qrfj6qm8 (53). Corresponding code has been published at https://github.com/sepalmer/predictive-coarse-graining.git.

Reproduced under the paper's license (CC BY-NC), from the paper cited above.

Versions

The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.

Version 2, 28 September 2026

  • Funding: added National Science Foundation: 2235451; Simons Foundation: MP-TMPS- 00005320

Version 1, 27 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 4 authors, 5 keywords, 76 references.

Cite

This paper

Durian, S. C. L., Bojanek, K., Marre, O., & Palmer, S. E. (2026). Preserving predictive information under biologically plausible compression. PNAS nexus, 5(7), pgag224. https://doi.org/10.1093/pnasnexus/pgag224

BibTeX

@article{durian2026preserving,
author = {Durian, Sylvia C L and Bojanek, Kyle and Marre, Olivier and Palmer, Stephanie E},
title = {{Preserving predictive information under biologically plausible compression}},
journal = {PNAS nexus},
year = {2026},
month = jun,
volume = {5},
number = {7},
pages = {pgag224},
publisher = {Oxford University Press},
issn = {2752-6542},
doi = {10.1093/pnasnexus/pgag224},
url = {https://doi.org/10.1093/pnasnexus/pgag224},
pmid = {42403907},
pmcid = {PMC13329666}
}

RIS

TY - JOUR
AU - Durian, Sylvia C L
AU - Bojanek, Kyle
AU - Marre, Olivier
AU - Palmer, Stephanie E
TI - Preserving predictive information under biologically plausible compression
T2 - PNAS nexus
J2 - PNAS Nexus
PY - 2026
DA - 2026/06/19
VL - 5
IS - 7
SP - pgag224
SN - 2752-6542
PB - Oxford University Press
DO - 10.1093/pnasnexus/pgag224
UR - https://doi.org/10.1093/pnasnexus/pgag224
LA - en
ER -

CSL-JSON

{
"id": "10.1093/pnasnexus/pgag224",
"type": "article-journal",
"title": "Preserving predictive information under biologically plausible compression",
"container-title": "PNAS nexus",
"author": [
{
"family": "Durian",
"given": "Sylvia C L"
},
{
"family": "Bojanek",
"given": "Kyle"
},
{
"family": "Marre",
"given": "Olivier"
},
{
"family": "Palmer",
"given": "Stephanie E"
}
],
"container-title-short": "PNAS Nexus",
"volume": "5",
"issue": "7",
"page": "pgag224",
"DOI": "10.1093/pnasnexus/pgag224",
"PMID": "42403907",
"PMCID": "PMC13329666",
"ISSN": "2752-6542",
"publisher": "Oxford University Press",
"URL": "https://doi.org/10.1093/pnasnexus/pgag224",
"language": "en",
"issued": {
"date-parts": [
[
2026,
6,
19
]
]
}
}

The tracing map gets a citation of its own once an author has validated it and it has a DOI.

Similar papers

The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.

[1] doi:10.1038/s41467-026-72619-x [code]
An inhibitory brainstem pathway reduces visual detection during background motion.
Journal: Nature communications
In common: 5 references
[2] doi:10.1126/sciadv.aeg3223 [code]
The extreme diversity of retinal amacrine cells has deep evolutionary roots.
Journal: Science advances
In common: 2 references, author Olivier Marre
[3] doi:10.1016/j.isci.2026.117088 [code]
Spatial biases in visual feature representation of mouse dorsal lateral geniculate nucleus boutons.
Journal: iScience
In common: Statistics and Machine Learning Toolbox, 4 references
[4] doi:10.1371/journal.pbio.3003915 [code]
Noise-invariant representations of sound emerge along the canonical cortical hierarchy.
Journal: PLoS biology
In common: Violinplot-Matlab, Optimization Toolbox, Statistics and Machine Learning Toolbox, 1 reference
[5] doi:10.1038/s41467-026-71151-2 [code]
Common and distinct neural correlates of social interaction processing and theory of mind in narratives.
Journal: Nature communications
In common: Violinplot-Matlab, Optimization Toolbox, Statistics and Machine Learning Toolbox, 1 reference
[6] doi:10.1002/advs.77857 [code]
Brain Network Dynamics of Local and Global Predictive Processing in Aging.
Journal: Advanced science (Weinheim, Baden-Wurttemberg, Germany)
In common: Violinplot-Matlab, Statistics and Machine Learning Toolbox, 2 references
[7] doi:10.1038/s41593-026-02350-9 [code]
Probing inter-areal computations with a two-photon holographic mesoscope.
Journal: Nature neuroscience
In common: Optimization Toolbox, Statistics and Machine Learning Toolbox, 2 references
[8] doi:10.1038/s41467-026-73540-z [code]
Predictive acoustical processing in human cortical layers.
Journal: Nature communications
In common: Optimization Toolbox, Statistics and Machine Learning Toolbox, 2 references
[9] doi:10.1038/s41467-026-76306-9 [code]
Non-invasive characterization of perivascular subarachnoid spaces.
Journal: Nature communications
In common: Violinplot-Matlab, Optimization Toolbox, Statistics and Machine Learning Toolbox
[10] doi:10.1162/netn.a.554 [code]
The turbulent brain: Modeling vortex interactions for understanding human cognition.
Journal: Network neuroscience (Cambridge, Mass.)
In common: Violinplot-Matlab, Optimization Toolbox, Statistics and Machine Learning Toolbox

Contribute

The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.

Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.

Request its removal

To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).

Discussion, reproductions, activity

Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.

Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.

Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.