Markov Chain Monte Carlo Simulations On SpiNNaker
This project contains code for running MCMC Simulations on SpiNNaker. This has been made general, to allow users to add their own MCMC models by providing a few simple components.
Adding your own model
C code
-
Create a C header file containing:
- A structure called
struct mcmc_params
which contains every fixed parameter that you require. - A structure called
struct mcmc_state
which contains each state variable that changes during the execution that you require.
An example can be seen in
c_models/mcmc_models/examples/lighthouse/lighthouse.h
- A structure called
-
Create a C source file containing and implementation of each of the functions in
c_models/mcmc_models/mcmc_model.h
An example can be seen in
c_models/mcmc_models/examples/lighthouse/lighthouse.c
-
Create a Makefile for your C code, which includes your source file. Call
make
to build your code.An example can be seen in
c_models/mcmc_models/examples/lighthouse/Makefile
-
Create a Python file containing a class which extends
mcmc.mcmc_model.MCMCModel
and implement each of the abstract methods therein.An example can be seen in
mcmc_examples/lighthouse/lighthouse_model.py
-
Create a Python script for your example, which calls
mcmc.mcmc_framework.run_mcmc
. This returns the results of the simulation.An example can be seen in
mcmc_examples/lighthouse/lighthouse.py