You are here

example code

Fun With Enforcers

I need to mention a fun thing that I did almost exactly when this site went offline. I signed up to volunteer in an RCMP training exercise scheduled for June 18, 2013. At the information session, the head of Risk Management UBC told us that one could either get up at 8am to play a regular hostage or get up at 6am to play a hostage wearing bullet hole makeup. I chose the former.

RCMP officers at UBC.

The RCMP officers tried to keep their techniques as secret as possible. I got this picture before the hostages went to their assigned buildings, but I didn't take any once I was inside. I don't think anyone else did either, for fear of being kicked out. The closest thing we have to a picture of the actual rescue comes from an article in The Ubyssey.

Simple Language Benchmark

As some of you may know, the programming languages I use the most are C and Python. One reason for this is popularity - I want to learn something that will help me edit the programs I use. I also think it's good to know at least one compiled language and one interpreted language. Interpreted languages or "scripting languages" are more convenient in most respects but they take longer to run. I already knew Python would be slower than C but I wanted to see how much slower.
Plot showing how long C and Python codes took to diagonalize various matrices.
To make the above plot, I used C and Python codes to diagonalize an n by n matrix and kept track of their execution times. Once you get past the small matrices, the trend that begins to emerge is that Python is ~30 times slower than C.

Applying An Epidemiological Model

As those of you who read my third most recent post will know, I recently became excited about methods for predicting the spread of diseases mathematically. When I learned about compartmental models, I began searching for tips on how they could best be applied to real data. I stumbled upon a solution on Abraham Flaxman's blog, Healthy Algorithms.

In Abraham's post, he presents some code that will estimate the parameters in a dynamical system using Bayesian Inference - the most elegant thing to come out of statistics since the Central Limit Theorem. Also present is an exercise challenging the reader to estimate the parameters of a 1967 smallpox outbreak in Nigeria.

If you want to do this exercise without a spoiler then stop! Otherwise, keep reading and I will tell you how I approached the problem while making some random remarks on the strengths and weaknesses of this particular fitting routine.

Subscribe to RSS - example code