NetLogo banner

 Home
 Download
 Help
 Resources
 Extensions
 FAQ
 References
 Contact Us
 Donate

 Models:
 Library
 Community
 Modeling Commons

 User Manuals:
 Web
 Printable
 Chinese
 Czech
 Japanese

  Donate

NetLogo User Community Models

(back to the NetLogo User Community Models)

Bayes1D

by Travis Monk (Submitted: 10/30/2013)

[screen shot]

Download Bayes1D
If clicking does not initiate a download, try right clicking or control clicking and choosing "Save" or "Download".

(You can also run this model in your browser, but we don't recommend it; details here.)

## WHAT IS IT?

This model illustrates how individual spikes and non-spikes can be interpreted as measurements about some state of the world, and how we can perform Bayesian inference on those measurements to infer about the world. In this model, the state of the world considered is the distance D from a predator (red) to a prey (blue). Given a probabilistic model of spiking given D, Pr(S|D), Bayes' rule states how to calculate Pr(D|S) given the outputs of the neurone.

## HOW IT WORKS

The predator has a neurone that fires a spike on a time step with probability Pr(S|D), as outlined in the manuscript. Given this conditional probability, which is plotted at the bottom of the screen, and a prior distribution Pr(D), we can infer the prey location Pr(D|S) by Bayes' rule. By letting the posterior distribution Pr(D|S) become the prior on the next time step, we can perform Bayes' rule recursively in time.

## HOW TO USE IT

To start, set the parameters of the model to your desired values. Choose whether the prior is a normal, uniform, or Dirac-delta distribution. Click the `setup' button, and you're ready to run simulations.

Next, click the `go' button. Click the button once to start running a simulation, and click again to pause it. The model is run at a sufficiently slow speed so that the viewer can see how individual spikes (and non-spikes) can be used to perform Bayesian inference about D. Every time step is one millisecond in duration. When the predator's neurone spikes in a time step, the predator's neurone flashes white and makes a pulse of sound. By Bayes' rule, the posterior Pr(D|S) shifts to the left. When the neurone doesn't spike in a time step, the posterior decays to the right. The observed spike train is streamed below. The sensor's conditional probabilities of spiking are in the lowest plot.

## THINGS TO NOTICE

Pr(D|S) converges quickly to the observed prey location when D is small, often in less than 500 time steps (one-half of one second in real-time), and even when the gain/noise ratio for the sensor is extremely small. When D is small (say 0.05 or so), then Pr(D|S) quickly converges on D = d, in as little as 20 or 30 timesteps, despite low gain-to-noise ratios.

The convergence of the posterior distribution to the observed prey location is insensitive to the prior distribution of the prey, so long as the prior has reasonably heavy tails. To verify this, run the model for a uniform, normal, and dirac-delta prior by changing the chooser labeled 'prior?' The posterior Pr(D|S) will converge on the observed prey location D = d, so long as the prior is not inconsistent with the observed prey location.

## THINGS TO TRY

Investigate how the gain-to-noise ratio affects the speed of convergence of Pr(D|S) to the observed value of D = d.

Investigate how the observed value of D = d affects the speed of convergence of Pr(D|S). The larger D = d is, the longer it takes Pr(D|S) to converge to D = d.

## EXTENDING THE MODEL

Spatial distributions of these sensors can provide information on the location of other organisms in higher dimensions. This is consistent with the notion of "skin brains" (Holland 2003).

To deal with the more general case of prey moving, we need to introduce the conditional probability Pr(X(t)|X(t-1)) (a dynamic prior). Then, the neurone becomes a rudimentary particle filter.

(back to the NetLogo User Community Models)