The online textbook Probabilistic Models of Cognition
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
dev Add click-em-all tester Nov 25, 2015
docs Create CNAME Aug 31, 2017
fonts Host Crimson Text font locally Dec 27, 2014
images Move UI images to images/ Nov 25, 2015
md Update Oct 3, 2016
scripts Move new-injector, globals into scripts/ Nov 25, 2015
webchurch @ 2cc0862 Update webchurch to 2cc0862 Jun 24, 2016
.gitignore Ignore node_modules/ and code/ Apr 17, 2014
.gitmodules Add webchurch as a git submodule Sep 23, 2013
CRP.swf Tidy non-parametric models chapter Dec 9, 2014
Makefile Move deploy script to Makefile Nov 25, 2015
README.markdown Detect pandoc version, make webchurch, (in progress) handle directory… Apr 5, 2014
apa.csl Do smart ligatures and use apa.csl (modified) Sep 10, 2013
chapter.template Move UI images to images/ Nov 25, 2015
chapters.txt Cut unfinished chapters from main list for now Apr 23, 2015
dev.bib Give up on Jackendoff overline Apr 24, 2015
index.template Move UI images to images/ Nov 25, 2015 Move .md files to md/ directory Nov 25, 2015
style.css Move UI images to images/ Nov 25, 2015



Source code for the online book, Probabilistic Models of Cognition.

Source files

Chapters are written in Pandoc-extended Markdown and should have a .md extension. There are three kinds of chapter files:

  • Index. An introduction to the book and a list of all public chapters. Lives in

  • Public. The main content of the book. The order of chapters is declared inside chapters.txt in the following format:


    (i.e., one filename per line, omit the .md portion)

  • Private. Used for the play space ( and any other pages that needn't be in the main content of the book.

I highly recommend reading through the Pandoc Markdown documentation before editing the chapter files. offers a good example of the syntax. One convention is worth mentioning. We use the "fenced" code-block syntax, e.g.,

~~~~ {data-engine="bher" data-exercise="simple-flip"}
(flip (0.5))

Within the curly braces, data-engine="bher" specifies that this code block will be run through the bher inference engine (the current choices are webchurch, bher, mit-church, and cosh). This engine property will be injected as a CSS class in the compiled HTML. The data-exercise property indicates the name of the exercise; this is used to organize records in the database of student-run programs. data-exercise is an optional property (in this case, the database won't store runs for this exercise), but if it is declared, it must be unique within the chapter file.

The look and feel of the book is controlled by three files: chapter.template, index.template, and style.css.


Use the command:

make all

If you want to compile just some subset of files, you can do:

make generative-models.html conditioning.html mixture-models.html

Some other commands:

  • make clean: Remove all compiled and intermediate files.
  • make rebuild: Do make clean and then make all.
  • make public: Compile only the public chapters.
  • make private: Compile only the private chapters.

Read the Makefile for details


  • Bash
  • Pandoc 1.11.1+
  • Python 2.7+
  • GNU make
  • GNU sed (if you're on OS X, you likely don't have this; try port install gsed)
  • Browserify

Development Notes


  • Add some directory structure to separate input (Markdown + assets [e.g., images]) from output.

build times (seconds)

single threaded: 10.8, 10.7 -j: 6.8, 6.9