<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Daniel Liu on Medium]]></title>
        <description><![CDATA[Stories by Daniel Liu on Medium]]></description>
        <link>https://medium.com/@cngzlsh?source=rss-b48c23adbb1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Stories by Daniel Liu on Medium</title>
            <link>https://medium.com/@cngzlsh?source=rss-b48c23adbb1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 02:07:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@cngzlsh/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[A Friendly(-ish?) Introduction to Neural Representations of Uncertainty]]></title>
            <link>https://medium.com/@cngzlsh/a-friendly-ish-introduction-to-neural-representations-of-uncertainty-2a6157b5cea0?source=rss-b48c23adbb1------2</link>
            <guid isPermaLink="false">https://medium.com/p/2a6157b5cea0</guid>
            <category><![CDATA[probability]]></category>
            <category><![CDATA[psychology]]></category>
            <category><![CDATA[neuroscience]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[bayesian-statistics]]></category>
            <dc:creator><![CDATA[Daniel Liu]]></dc:creator>
            <pubDate>Wed, 07 Sep 2022 14:48:11 GMT</pubDate>
            <atom:updated>2022-09-08T10:16:54.417Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Last edit 07 Sep 2022</blockquote><h3>Motivation</h3><p>The brain is perhaps the single most complex and elegant creation of nature. Human brain weighs up to 1.5 kg — about 2% of average person’s weight — but consumes up to 20% of our energy intake. It is our only evidence of the existence of intelligence. Yet the way our brains perceive the world is still not fully understood.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*uN-tst32HIaQz5CM" /></figure><p>Imagine seeing a cat on the street when you walk home.</p><p>How do you know it is a cat, but not a dog?</p><p>At first glance, this question might seem simplistic — but from the brain’s perspective, what really happened was photons reaching your sensory receptors in the retina, eliciting firings of 100 million rod cells and cone cells, leading to the forming of an image of a cat — to infer that it was a <strong>cat</strong> that <strong>caused</strong> these 100 million neuronal firings, was really not an easy task. So how is this done?</p><h3>Perception</h3><p>Years of anatomical and experimental evidence showed that the brain maintains an <em>internal generative model</em> of the world: a mental model that gives rise to our sensory observation from the unobservable state of the environment through sensory signals. If we describe the <strong>latent state of the environment</strong> with <em>z</em>, then our <strong>observation</strong> arising from sensory receptors in the peripheral nervous systems, <em>x,</em> is a non-linear, complicated mapping <em>x=f(z)</em>. The goal of higher-order visual cortex is to invert the mapping:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/131/0*vDVonIMvZD4jAdDZ.png" /></figure><p>— thus reaching the conclusion that it is a cat.</p><blockquote>‘A cat is just some low-dimensional manifold in the latent space.’ — Peter L in one of the SWC lectures</blockquote><h4>Uncertainty in Perception</h4><p>Unfortunately, the generative process itself is often noisy: uncertainty is ubiquitous in our nervous system. As a simple observation, our nervous system’s response to the same stimuli — the same cat on the street — varies from trial-to-trial. There are many factors underlying this: noise in photo-transduction, failures in synaptic release between neurons, or perhaps the generative process itself— a dog in the dark might be recognised as a cat sometime, isn’t it? Ultimately, it is only reasonable to formalise the brain’s observation in the <em>probabilistic </em>domain, that is, a generative model specified by</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/235/0*ZXZViP66PyY_W-p7.png" /></figure><p>Where <em>z</em> is the latent stimuli — the cat— from the environment and <em>x</em> is the brain’s response —the firing of neurons in the retina.</p><p>The goal of the brain is to <em>infer</em> the latent stimuli — having observed the neuronal responses, find the <em>posterior probability p(z|x) </em>that it is a cat.</p><p>This theory is widely known as <em>the Bayesian Brain. </em>Many branches within the Bayesian Brain framework have been proposed: predictive coding, population coding, free energy minimisation… But central to all of them is the consensus of the internal model of the brain, and that our nervous systems carries out computations similar to Bayesian inference.</p><h3>Unconscious Bayesian Inference</h3><p>So how is the posterior probability computed in the brain? Baye’s rule tells us:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/469/0*FkCkUDBHXjBTlZts.png" /></figure><p>This computation requires finding the <em>marginal probability</em> of observation <em>p(x)</em>, by integrating out the latent <em>z</em> — that is, the average sensory response under <em>the distribution of all latent states of stimuli in the world, including cats </em>(if someone ever finds this out, please let me know). In the language of maths and stats, this integration is only <em>analytically tractable</em> if <em>x</em> and <em>z</em> lie in the <em>conjugate-exponential family</em>, but of course this is generally not the case. To add to the complexity, the response <em>x</em> is almost certainly high-dimensional and embedded in time-series (consider the trajectory of 100 million rod and cone cells!), and the transformation mapping from <em>z</em> to <em>x</em> is far from linear.</p><p>This intractability has been a ‘pain-in-the-backside’ for (Bayesian) machine learning practitioners for ages. If you are one of them, you might have already traversed to the realms of <em>approximate inference</em>, and heard of fancy jargons such as <em>Laplace approximation, variational inference </em>or <em>expectation propagation</em>. Unfortunately, these seemingly complex algorithms often yields sub-optimal results, despite requiring plenty of (iterative) computations. Conversely, our brains’ intriguing handling of this computation is elegant, subtle, efficient, and almost close to optimum — it doesn’t take long to tell it’s a cat, does it?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/696/0*e4q4ZLN6Ae2DkeZU.jpg" /></figure><p>Our understanding of biologically-plausible Bayesian computation and representation of the posterior distribution is very limited. Nevertheless, it is commonly accepted that this computation is <strong><em>amortised — </em></strong>one need not optimise for each cat separately, but using a universal, learnt model, thus spreading the computational costs of inference. This model is dubbed the name <strong><em>recognition model</em></strong> for its purpose to <em>recognise</em> the latent stimuli given observation. A close correspondence from the machine learning community is the <em>Variational Autoencoder (VAE)</em>, where a deep neural network maps observation <em>x</em> to parameters of the latent distribution <em>q(z|x), </em>often mean vector and covariance matrix of a Gaussian (hence the meme above)<em>. </em>VAEs have also made a considerable impact in the theoretical neuroscience community.</p><p>Of course, the brain does not write out formulas and equations with pen and paper (or iPads nowadays?): the processing of information is performed by neuronal circuits through chemical transductions at synapses (and to a lesser extent, electrical transductions at gap junctions). The distribution <em>q(z|x) </em>is often considered to be <em>encoded</em> by the firing rates, <strong><em>r</em></strong>, of a population of neurons in higher-order sensory areas.</p><p>Below, we discuss various proposed schemes of how the intractable posterior distribution is represented and the computations requiring <em>q(z|x)</em> are mediated.</p><h3>Enccoding? Decoding?</h3><p>Here we distinguish between:</p><ul><li><strong>Encoding</strong>: given the <em>stimulus</em>, an encoding model compresses its information, turning the distribution of stimulus into spike timings;</li><li><strong>Decoding</strong>: given the <em>response</em>, a decoding model aims to recover the original (distribution of) stimulus that caused the response.</li></ul><h4>The Poisson Encoding Model</h4><p>One important encoding model in neuroscience is the Poisson model. In essence, this model assumes the number of resulting spikes is Poisson-distributed around a mean rate, and the mean rate itself is a function of the stimuli:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/248/0*VbLtbZKrYe6XoDmA.png" /></figure><p>This is known as <em>rate coding</em>, and the function f is known as the <em>tuning function</em>.</p><h4>MAP Decoding of the Poisson Model</h4><p>Having observed the spikes from population neurons, one can decode the MAP estimate of the stimulus value <em>z</em>, by Baye’s rule:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/515/0*4HiBzxKQjznqhhHT.png" /></figure><p>The Poisson Model assumes each neuron’s firing is independent, which in reality is not the case. The exact posterior is not tractable — knowing the tuning functions (up to scaling) can allow us to decode the MAP estimate of the stimulus value. However, the Poisson Model is limited in the way that it encodes only a single value of <em>z</em>: whilst randomness is introduced around the Poisson mean firing rates, the decoded density asymptotically becomes a single point, namely, a dirac-delta distribution. In other words, thisdoes not convey uncertainty about the stimulus.</p><h3>Deterministic Coding of Uncertainty</h3><h4>KDE Codes</h4><p>The <strong>Kernel Density Estimation codes</strong>, also known as <strong>linear density codes</strong>, represents a distribution by a linear combination of some basis function, <em>ψ,</em> for each neuron <em>i</em>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/269/0*fEMUQ5gcMLoYuGKl.png" /></figure><p>Where <strong><em>r</em></strong>’s are the mean firing rates of each neuron, and Z is a normalisation constant ensuring <em>q</em> integrates to 1. An alternative view is to treat <em>q</em> as a <em>mixture</em> distribution, if <em>ψ’s </em>themselves are also densities and the (normalised) firing rates are mixing proportions: given enough mixing components one can model (almost) any density. However, reversing the coding process — finding the activity <em>r </em>for each neuron given stimuli — is generally difficult under this scheme. Even by knowing the form of <em>ψ</em>’s, such as Gaussian, learning (e.g. by the EM algorithm) is not guaranteed to converge to a global optimum.</p><h4>Distributional Population Codes</h4><p>Building on the Poisson model, <strong>Distributional Population codes (DPC) </strong>was introduced to encode a distribution of stimulus <em>q(z)</em> rather than a single value <em>z</em>, using a set of expected tuning/encoding functions under <em>q</em>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/194/0*xU_Q_diWr-1620hS.png" /></figure><p>For Gaussian basis functions which are translated versions of one another in a large population of neurons, the right hand side becomes a convolution of <em>ψ </em>and<em> q</em>, therefore DPC is also given the name <strong>Convolutional Density codes. </strong>Quite a contrary to KDE codes, DPC is defined from an encoding perspective: decoding the density <em>q</em> from the firing rates <strong><em>r </em></strong>is non-trivial.</p><h4>Doubly Distributional Population Codes</h4><p><strong>Doubly-DPC (DDPC)</strong> is an extension from DPC that addresses the <em>multiplicity</em> of stimuli, a modality that cannot be represented in conjugation with uncertainty in DPC: multiple values of <em>z</em> may need to be represented simultaneously, a classic example being multiple sources of sound signals, or in our example, simultaneous presence of multiple cats in a scene.</p><p>Instead of a distribution <em>q(z)</em>, DDPC encodes a distribution over function <em>m(z)</em>: <em>q[m(z)] </em>is said to<em> </em>capture the <em>uncertainty </em>and <em>m c</em>aptures the <em>multiplicity</em> of stimuli. The encoded distribution<em> q </em>effectively becomes a functional:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/266/0*tpXLK9M9HswWuNP_.png" /></figure><p>DDPC reduces to DPC if <em>m</em> is a dirac-delta function.</p><h4>Distributed Distributional Codes</h4><p><strong>Distributed Distributional Codes (DDC) </strong>takes on the same encoding framework of DPC. Additionally, DDC interprets the distribution <em>q </em>specified by DPC as <em>maximally uncertain</em> having observed the neural responses: a distribution of maximum entropy given the expected values of encoding functions <em>ψ.</em></p><p>One can show, by enforcing normalisation of the encoded distribution and the observed firing rates as expected values of encoding functions using Lagrange multipliers, that the maximum entropy distribution</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/463/0*O_4ypx4bzjGyJb8x.png" /></figure><p>is a member of the <em>exponential family</em>, with the encoding functions as its sufficient statistics. Whilst finding the natural parameters <strong><em>θ</em></strong> and thus the full distribution <em>q’(z)</em> is non-trivial, this is argued to be rarely needed in the brain: most key computations relies only on the expectation under <em>q’(z|x)</em>, such as belief propagation and marginalisation (equivalent to expected conditional probability) and evaluating expected future rewards. Assuming a required function as a linear combination of <em>ψ </em>(with weights to be learnt by standard linear regression), then the expected value of that function can be directly read out as the linear combination of observed rates.</p><h4>Log-linear Codes</h4><p>We continue from previous discussion of the Poisson model: a key observation is that the log posterior is <em>linear</em> in the neural responses <strong><em>r</em></strong>. This class of population coding scheme is often known as <strong>Log-Linear Codes</strong>. Log-linear Codes assume the uncertainty about the stimuli arises from Poisson-like noise: multiple stimulus could have given rise to the same spiking pattern. Log-linear Codes have the advantage that multiplying distributions essentially becomes linear operations, thus allowing efficient computations such as <em>cue combination.</em></p><p>One type of Log-linear codes, the <strong>Probabilistic Population Codes (PPC)</strong>, interpret the posterior distribution as an exponential family distribution with the tuning curves <strong><em>f</em></strong><em>(</em>z<em>)</em> as sufficient statistics and neural activities <strong><em>r</em></strong> as the natural parameters.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/0*kdjvAeQrw0cMoFfd.png" /></figure><p>This formulation makes the encoding hard to learn due to the assumption of Poisson variability: multiple stimulus value can give rise to the same observation.</p><p><strong>Natural Parameter Codes</strong>, on the other hand, assumes the firing rates <strong><em>r</em></strong> correspond to the natural parameters of the encoded distribution:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/297/0*83i6tBZ0BBq2Xo3a.png" /></figure><p>In this formulation, firing rates are <strong><em>r </em></strong>deterministic mappings of observations <em>r=ρ(x)</em> rather than indirectly through Poisson variability <strong><em>r</em></strong><em> ~</em> Poisson<em>(</em><strong><em>f</em></strong><em>(z)) </em>in PPC. Trial-to-trial variability in <strong><em>r </em></strong>is still present due to noisy transduction in sensory receptors (the generative model). Nevertheless, it retains the convenience of additive cue combination property just like PPC.</p><h3><strong>Stochastic methods</strong></h3><p>Inspired by the success of sampling-based approaches in statistical machine learning — such as MCMC — stochastic approaches to approximate posterior computations have also been proposed, known as the <em>neural sampling hypothesis</em>. We shall return to these approaches in the next article.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2a6157b5cea0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>