Efficient coding, efficiently coded

Gilles de Hollander

Computation in Neuroeconomics seminar, Soglio, Switzerland, 2025
Efficient Coding: Key Ideas

1. Sensory Space Representation

  • Objective stimulus features encoded in 'neurocognitive' sensory space ()
  • Noise on is, by definition, homoscedastic (constant variance)
  • Encoding function:
    e,g., ()
  • Neurocognitive representation given a objective stimulus is a random variable.

Computation in Neuroeconomics seminar, Soglio, Switzerland, 2025

Efficient coding: Key ideas

2. Bayesian Inference

  • Estimate stimulus value of stimulus , using Bayesian inference:
  • Posterior distribution:

  • Posterior mean is least-square estimator

Computation in Neuroeconomics seminar, Soglio, Switzerland, 2025

Why computational graphs?

  • For model fitting we want to estimate parameters.
  • Often we can not derive likelihood functions, but we can evaluate them for specific values.
    • Approximate integrals using grids (GPU!)
    • MCMC sampling
  • Both often involve the same calculation on a very large number of variables.
Computation in Neuroeconomics seminar, Soglio, Switzerland, 2025

Implementation Steps

1. Define the Generative Model

  • Encoding function:
  • Noise model:

2. Build the Likelihood Grid

  • Create a grid of possible and values
  • Make a for each pair

3. Bayesian Inference

  • For each observed , compute the posterior:

  • Estimate as the expected value:

4. Data Likelihood Function

  • Define a function that returns the response distribution over for any : .
Computation in Neuroeconomics seminar, Soglio, Switzerland, 2025

Approach

Approximate (bounded) distributions using large arrays (vectorize, vectorize, vectorize).

Computation in Neuroeconomics seminar, Soglio, Switzerland, 2025

Assignment 5: Efficient coding

  • We wil now go over some code together in notebooks/5_efficient_coding.ipynb
Computation in Neuroeconomics seminar, Soglio, Switzerland, 2025