Sept. 16, 2012, 10:04 p.m.

## Detoxification Diet

I spent the last two weeks cleansing my body of years of accumulated waste and slug. I was assigned a very, very specific detoxification diet, designed to remove toxins naturally. More on that in a second. My friend and a soon-to-be naturopathic doctor Chelsea Schreiner both gave me the idea for this OWO and mentored me throughout the process. Ideally, this should be a 3-6 weeks long regime, but as I have better things to do and try, I compromised with a two week regime. It was more than enough.

So, what is a detoxification diet? It is a diet designed to naturally support your body's detox instruments, namely your liver. By ingesting some foods, according to the theory, your liver will increase its detox process, but in this new active state it must be supported. And, to let your liver sweep up everything, it must not be muttled down by extraneous toxins. What do I mean by extraneous toxins: all most everything delicious. Let's examine what I couldn't eat:

• red meat
• dairy products
• peanuts
• soy
• processed sugar
• corn and corn byproducts
• wheat
• gluten
• oats, barley etc.
• alcohol =(
• vegetables from the Nightshade family, eg: tomatoes, potatoes, eggplant, peppers
• bananas, citrus, strawberries
• and finally, caffeine. f**k

It was this last item that was most detrimental to my well being: two weeks without caffeine is an OWO of itself, and here it was merely a side constraint. As a thrice-daily coffee drinker, I have built up a strong tolerance and, one may say, dependence on coffee. Little did I understand how serious the relationship was. More later.

So looking at the set of all foods, what I could eat was a pretty small set. The idea of the diet is to take in large amounts of vegetables. So one having a good hand at cooking vegetables is key to doing this diet. Lucky, I'm fucking awesome. But this only solves a partial problem: vegetables are not enough! And without wheat and potatoes, you have to get creative with substantial foods to eat. Enter quinoa: the most delicious, detox-friendly grain known to man. I created a wonderful quinoa dish that I would be happy to eat whether detoxing or not (the recipe is at the bottom of this article). What about breakfast - what did I eat for breakfast? Typically it was light: an apple, a glass of almond milk + a pea-derived protein powder. Lunch was usually a soup I prepared: common was split pea soup or carrot-ginger soup. I made a really nice spinach curry soup that I would make again. Supper was again soup, curried cabbage or quinoa salad. On a diet like this, it is important to snack often, lest you have 0 energy, so I supplemented by meals with carrots + humus, celery + tahini, nuts, fruit and daydreams of doughnuts.

Ok, so what happened? How did the two weeks go? Bad, then good. I underestimated what caffeine withdrawal was like. What an unpleasant feeling! Head and body-aches, and constant feelings of lethargy. For four days I suffered like this. The only relief was my constant naps in classrooms. In my experience, a brain without caffeine, or some other stimulant, is a dull brain. I constantly felt unmotivated, and even apathetic at times. Contrast this to now where all I can think about is 'how can I get more shit done in less time--oh and my coffee cup is empty'. So included in my caffeine withdrawals was withdrawals from my regular diet. Chelsea, my mentor, recommends to her patients who embark on a detox diet to gradually eliminate foods. Not me. I don't have time for that. So I literally went from gorging on junk (in preparation of a two-week fast), to clean, sugar-free, diet. The shock layered my sufferings. So if the first week was bad, the second week was much better. I found my cooking and diet stride. Preparing food was easier. Even my palette changed, and I found sweetness and flavour where I otherwise never did. But still the issue of lethargy hanged over me. Over the two weeks, I could not dispel it. My body - no, my brain - is powered by coffee.

I did feel better eating all these vegetables and avoiding nasty foods. Whether the feeling with an actual mental response to less bodily toxins, or purely psycho-somatic is debatable. I slept better. I was more regular (infact my whole digestive tract changed for the better). I lost a few pounds (actually I'm not sure, but probably). But I knew this diet was temporary. I had my entire day's diet planned the day after this experiment was finished: coffee + cinnamon buns in the morning, burger and fries for lunch, and Indian food for dinner. And a beer. Waking up that morning was like Christmas morning!

What are my thoughts on the diet now? I think it is an interesting diet for those for which it is recommended. I entered the diet only because it was a challenge, not for any health benefits or allergen profiling.

So I know this write-up was late, and in fact I have already done another OWO inbetween when I finished this and now (it was a private one, sorry can't say what it was), but next week I will be bullying my morals around. Stay tuned and stay away from me next week. =)

Ingredients:
• 1 cup of quinoa grain
• tsp of cumin
• splash of olive oil
• splash of balsamic vinegar
• chopped spinach
• diced red onion
• diced green onion
• optional: chopped radishes, chopped almonds, or grated carrots
• salt and pepper to taste

Wash the quinoa in cold water. Add two cups of water, add some salt and the cumin. Bring to a boil. Reduce to a lower simmer. Once all the liquid is absorbed, let it sit to room temp. Put into fridge to cool (or freezer w/e). As the quinoa is cooling, prepare vegetables. Combine remaining ingredients once quinoa is cool enough. Eat .

• Detoxification Diet
• Eating Tim Hortons
• Being Roman Catholic
• Sleeping 4 hours a day
• Meditation
• Bulk Barn diet
• Not looking at mirrors
• Veganism
• No Internet

## Blogs

October 03th, 2013

### Evolutionary Group Theory

We construct a dynamical population whose individuals are assigned elements from an algebraic group $G$ and subject them to sexual reproduction. We investigate the relationship between the dynamical system and the underlying group and present three dynamical properties equivalent to the standard group properties.

continue...

August 25th, 2013

### Videos about the Bayesian Methods for Hackers project

1. New York Tech Meetup, July 2013: This one is about 2/3 the way through, under the header "Hack of the month"

Available via MLB Media player
2. PyData Boston, July 2013: Slides available here

continue...

August 03th, 2013

### Warrior Dash 2013

Warrior dash data, just like last year: continue...

June 16th, 2013

### The Next Steps

June has been an exciting month. The opensource book Bayesian Methods for Hackers I am working on blew up earlier this month, propelling it into Github's stratosphere. This is both a good and bad thing: good as it exposes more people to the project, hence more collaborators; bad because it is showing off an incomplete project -- a large fear is that advanced data specialists disparage in favour of more mature works the work to beginner dataists.

continue...

June 08th, 2013

### NSA Honeypot

Let's perform an experiment.

continue...

Oct. 3, 2013, 12:26 a.m.

## Evolutionary Group Theory

We construct a dynamical population whose individuals are assigned elements from an algebraic group $G$ and subject them to sexual reproduction. We investigate the relationship between the dynamical system and the underlying group and present three dynamical properties equivalent to the standard group properties.

# Introduction

Consider a sufficiently large population of $N$ individuals. Interactions between individuals is a binary action i.e.interactions involve two individuals in a possibly non-symmetric manner. An interesting assumption is to consider if the population consists of individuals from an algebraic group. Recall the definition of a group : A set, $G$, and binary operator $\ast$ is called a group iff

1. there exists an identity element, $e$, s.t. $\forall x \in G, x\ast e=e \ast x = x$.

2. $\forall x \in G$ there exists an inverse, $x^{-1}$, s.t. $x\ast x^{-1}=x^{-1}\ast x = e$.

3. $\forall x,y \in G, x\ast y \in G$ and $y\ast x \in G$.

As two individuals interact, one or more new individuals are produced that belong to the same group: this is a closed system. What would the behaviour of a system look like if all individuals were members of a group? Can we find such systems in nature, or are our constructions purely artificial?

# Some notation and terminology of Group Theory

We call the order of group $G$ the number of elements in the group, denoted $|G|$. A group, $G$, is called abelian if the operation is commutative, i.e. $\forall x,y \in G, x\ast y = y\ast x$. A subset $H \subset G$ is called a subgroup iff $e\in H, \forall x \in H \Rightarrow x^{-1} \in H$, and $H$ is closed under the binary operation. A Cayley table of a group is $n \times n$ matrix where the $(ij)th$ entry is the product of the $ith$ and $jth$ element. For example, consider $\mathbb{Z}_2\times \mathbb{Z}_2=\{(0,0),(1,0),(0,1),(1,1)\}$ under addition mod 2. The Cayley table is $\left[ \begin{array}{cccc} (0,0) & (1,0) & (0,1) & (1,1)\\ (1,0) & (0,0) & (1,1) & (0,1)\\ (0,1) & (1,1) & (0,0) & (1,0)\\ (1,1) & (0,1) & (1,0) & (0,0) \end{array} \right]$

This matrix completely defines the group.

# A simple stochastic model

We describe a stochastic process that will characterize our evolving population. Consider again a population of $N$ individuals where $N_i(t)$ denote the number of $i$ individuals (elements) in the population. We consider the interaction between two individuals to represent sexual reproduction. The birth-death process begins by two individuals being randomly chosen proportional to their frequency in the population. The new offspring ( product of the two individuals) is substituted (death) for another randomly chosen individual, again proportional to frequency (thus the population size is constant). The process is repeated for each time step. For example, consider the group $\mathbb{Z}_2=\{0,1\}$. Recall that in this group $1\ast1=0$, so the probability the the population of 1s increases, i.e. $N_1(t+1) = N_1(t) + 1$, is equal to the probabilty a 1 and 0 are chosen as parents, and a 0 is chosen to die:

\begin{aligned} P^{+} &=P(N_1(t+1)=N_1(t)+1| N_1(t))\\ &=\left( \frac{N_1(t)}{N} \frac{N_0(t)}{N-1}+\frac{N_0(t)}{N} \frac{N_1(t)}{N-1}\right) \frac{N_0(t)}{N}\\ &=\left( \frac{2N_1(t)}{N} \frac{N_0(t)}{N-1}\right) \frac{N_0(t)}{N}\end{aligned}

since for the population $N_1(t)$ to increase by one in a time step, the new individual resulting from the interaction must be a 1 and the death must be a 0. Similarly,

\begin{aligned} P^{-} &=P(N_1(t+1)=N_1(t)-1| N_1(t))\\ &=\left( \frac{N_1(t)}{N} \frac{N_1(t)-1}{N-1}+\frac{N_0(t)}{N} \frac{N_0(t)-1}{N-1}\right) \frac{N_1(t)}{N}\\\end{aligned}

and $P^{0}=P(N_1(t+1)=N_1(t)| N_1(t))=1-P^{+} -P^{-}$. Thus we have

\begin{aligned} E[N_1(t+1)|N_1(t)] &=P^+\cdot (N_1(t)+1)+P^-\cdot (N_1(t)-1)+P^0\cdot (N_1(t))\\ &=P^+-P^-+N_1(t)\Rightarrow\end{aligned}

$E[N_1(t+1)-N_1(t)|N_1(t)]=P^+-P^-$ Working with probabilities can be unwieldy, so we take the limit as $\Delta t\rightarrow 0$ and $N \rightarrow \infty$. If we denote$N_1(t)/N \approx x$ (then $N_0(t)/N \approx 1-x$), we have

\begin{aligned} &P^+=2x(1-x)^2\\ &P^-=x(x^2+(1-x)^2) \Rightarrow \\ &\frac{dx}{dt} \approx P^+-P^-= x(1-2x)\end{aligned}

This system has asymptotically stable points at $x=0$ and $x=1/2$, i.e. when the population of 1’s is extinct or equal to the population of 0’s.

# General model

Initially, to model such an evolving system, we consider only $\Delta t\rightarrow 0$ and $N \rightarrow \infty$. Thus we enter the well-studied realm of continuous dynamical systems. Given a group of order $n$, we need some way to introduce the group structure into the dynamical system. The Reverse Cayley matrix, $A$, is defined as an $n\times n$ matrix where the $ith$ column of $A$ contains the product of frequencies such that the product of the corresponding elements is the $ith$ element of the group. For example, consider $\mathbb{Z}_2\times \mathbb{Z}_2=\{(0,0),(1,0),(0,1),(1,1)\}$, and let $e,x,y,z$ denote the frequencies of the enumerated set. Then define $A$ as $\left[ \begin{array}{cccc} e^2 & ex & ey & ez\\ x^2 & xe & xz & xy\\ y^2 & yz & ye & yx\\ z^2 & zy & zx & ze \end{array} \right]$ The matrix can easily be constructed from the group Cayley table. In each row, for every element $g \in G$, there exists a pair of elements such that the product is $g$. Compare the Reverse Cayley matrix with the the Cayley matrix for $\mathbb{Z}\times \mathbb{Z}_2$ given in section 2.

The dynamics of the system are given by the following system of equations, analogous to the limiting case in the example with $\mathbb{Z}_2$. It is straightforward to show the dynamics are the same. In what follows, $\mathbf{1}$=(1,1…,1) and $\mathbf{e_i}$ are the standard euclidean basis vectors and $x_i$ is the $ith$ element in the group.

\begin{aligned} \dot{x}_j &=P^{+}_{j}-P^{-}_{j}\\ &=\left(\sum^{n}_{i=1}\ A_{ij}\right)(1-x_j) - \left(1-\sum^{n}_{i=1}\ A_{ij}\right)x_j\\ &= \sum^{n}_{i=1}\ A_{ij} - x_j \\ &= \mathbf{1}\cdot A \mathbf{e_j} - x_j \text{ which can also be rewritten, if convenient, as}\\ &=\mathbf{1}\cdot A (-x_1,\ldots, -x_{i-1},1-x_i,-x_{i+1}, \ldots,-x_n)^T\end{aligned}

This greatly simplifies our dynamics. In fact, it is now trivial to show that the barycenter of the $n$-simplex, $S_n$, is an interior stable point: suppose the frequency vector $\vec{\mathbf{x}}=(1/n, \ldots, 1/n)$, then $A=A(\vec{\mathbf{x}})=\frac{1}{n^2}J_n$, where $J_n$ is the matrix full of ones, then

\begin{aligned} \dot{x}_i &=\frac{1}{n^2}\mathbf{1}\cdot J_n (1/n,\ldots,1-1/n,\ldots, 1/n)^T\\ &=\frac{1}{n^2} n\mathbf{1}\cdot (1/n,\ldots,1-1/n,\ldots, 1/n)^T\\ &=\frac{1}{n}(1-\frac{1}{n}-\ldots -\frac{1}{n})=0\end{aligned}

For the rest of the paper, let $x_1$ represent the frequency of the identity element of the underlying group $G$. Recall the heuristic definition of an invariant manifold is a manifold, $N$, such that if the system starts somewhere in $N$, it stays in $N$ for all time . A useful concept in this study is the support of an invariant manifold, $N$, defined as the following: $i\in Supp(N)$ iff $x_i>0$ in $Int(N)$. Define the order of the manifold, denoted $|N|$, as $|Supp(N)|$.

Theorem: $\{ i_1, i_2, ...,i_k\}$ is an subgroup of G iff the sub-manifold of the dynamical system with support $\{ i_1, i_2, ...,i_k\}$ is invariant.

Suppose a population is described by an underlying group $G$, and $H$ is a subgroup of $G$. For all $x_i\in G \setminus H, x_i=0$. Then $\dot{x}_i=\mathbf{1}\cdot A\mathbf{e_i}$. I claim that all elements in the $ith$ column of $A(\vec{\mathbf{x}})$ are zero. If there was an element in the column that was non-zero, say $x_k x_j$, then $x_k x_j=x_i$ by definition of the reverse Cayley matrix $A$. But as $x_k, x_j$ are non-zero, elements $k$ and $j$ and belong to $H$. As $H$ is a (sub)group, this implies $k \ast j = i \in H$, a contradiction. Thus, as the $ith$ column is all zero, $\dot{y}_i=0$.

On the other hand, suppose that H is not a subgroup. Then there exists $u,v \in H$ s.t. $u\ast v =k \not \in H$ thus $x_k=0$ while $x_u,x_v>0$. Then $x_u x_v$ is in the $kth$ column of $A$. Thus $\dot{x}_k=\mathbf{1}\cdot A\mathbf{e_k}>0$ and the system is not invariant.

The above proposition implies that not all sub-simplicies of this system are invariant. If we consider the group $\mathbb{Z}_2\times \mathbb{Z}_2$, then the only invariant manifolds of the system, described in terms of sub-simplicies of $S_4$, are: the interior of $S_4$, the interior of the three edges projecting from $(1,0,0,0)$ and the point $(1,0,0,0)$. It is clear that, say, $\mathbf{e}_2=(0,1,0,0)$ is not an invariant manifold of the system as $(1,0)\ast (1,0) = (0,0) \not= (1,0)$, thus the system will evolve away from the point. It is clear that all invariant sub-manifolds of the dynamical system are actually sub-simplicies of $S_n$. Both terms will be used interchangeably for the remainder of the paper.

Theorem: $1\in Supp(N)$ for all invariant manifolds of the dynamical system.

Theorem: If all the 2-dimension simplicies extending from $\mathbf{e}_1$ are invariant, then the underlying group is abelian.

The assumption implies that $\{e,i\}$ is a subgroup for all $i \in G$. Thus, by the necessity of (sub)groups, $i\ast i =e$ for all $i \in G$. It is a well-known (and interesting) theorem in group theory that this condition implies the group is abelian.

There is an alternative way to describe the dynamical system that will be used in the next proposition. Define $B_k$ as the binary Cayley matrix s.t. if elements $i\ast j=k$, then $(B_k)_{ij}=1$ and 0 otherwise, for all $1 \le k \le n$. Clearly $\sum_k\ B_k = J_n$ where $J_n$ is the $n\times n$ matrix of all ones. A property of $B_k$ is that the columns of the matrix are the standard euclidean basis vectors. It is simple to show the dynamical system can be rewritten as:

$\dot{x}_i =\vec{\mathbf{x}}\cdot B_i \vec{\mathbf{x}} -x_i$

Prop: The barycenter of an invariant sub-manifold is (asymptotically) stable.

What follows is a partial proof. Taking the time derivative of the Lyapunov function $V(\vec{\mathbf{x}}) = \sum\ x_{i}^2$ as seen in , we get

\begin{aligned} V'/2 & = \sum_i\ \vec{\mathbf{x}} \cdot x_i B_i \vec{\mathbf{x}} - \sum_i x_{i}^2 \\ & = \vec{\mathbf{x}} \cdot \sum_i \ x_i B_i \vec{\mathbf{x}} - \vec{\mathbf{x}} \cdot I \vec{\mathbf{x}} \\ & = \vec{\mathbf{x}} \cdot ( D-I) \vec{\mathbf{x}}\end{aligned}

where $D = \sum \ x_i B_i$. Next is an exercise to show that $D-I$ is a (semi) negative definite matrix which is equivalent to showing its eigenvalues are (negative) non-positive. I have not been able to generalize the idea to every system yet.

Using this new approach in notation, we can translate the properties of groups, outlined in the introduction, to the language of dynamical systems if the population follows our birth-death process.

1. Unique Identity Element: the only invariant sub-manifold with order 1 is $\mathbf{e}_1=(1,0,..,0)$.

2. Unique Inverse Element: $B_1$ is symmetric.

3. Closure: the interior of the simplex $S_n$ is invariant.

1. This is clear as the only subgroup of order 1 of any group is $\{e\}$, thus the only invariant manifold with order 1 is a population of just identity elements. On the other hand, if the only invariant manifold with order 1 is $(1,0,..0)$, then $\{x_1\}$ is the only subgroup of order 1 of the underlying group. Thus, as $e$ belongs to every (sub)group, $x_1=e$.

2. For any $x \in G$ with enumeration $i_x$, there exists a 1 in the $i_x$ column of $B_1$. This means, there exists a $y \in G$ s.t. $x*y=e$. As $B_1$ is symmetric, this also implies in the $i_y$th column of $B_1$, there is a 1 in row $i_x$, implying $y*x=e$ . A remark: this is a poor characteristic of the unique inverse element property, as it relies too much on $B_i$. I would prefer a more dynamical definition.

3. Follows from the proof of proposition 3.1.

Aside from the poor definition of a unique inverse element, it would be a interesting question to ask, if a dynamical system satisfies the three characteristics above then does there exists an underlying group? Let’s tentatively say, if a given dynamical system satisfies the above three properties, we call such a system a Group-Equivalent system. Then, if there exists an underlying group, the system is Group-Equivalent i.e. satisfies the above properties; if a system is Group-Equivalent, does there exist an underlying group "driving" the system? A system driven by group $G$ is not unique as adding multiplicative constant does not change the dynamics.

Suppose a dynamical system has an underlying group structure. Then by Lagrange’s Theorem (the order of every subgroup of $G$ divides the order of $G$) we know that the order of every invariant sub-manifold divides the order of $S_n$ (recall $|Int(S_n)|=n$). Suppose now that a system is Group-Equivalent, and it is true that this implies an underlying group structure. Can we prove Lagrange’s Theorem using a dynamical approach?

# Conclusion

The last few remarks foreshadow the possibilities of studying a dynamical system with an underlying group, or a Group-Equivalent system. Two ideas can next occur: First, we use dynamical systems theory to prove theorems in group theory; second, we use group theory to solve problems involving dynamical systems. I believe the former to be of little value outside of itself; the literature and research in group theory is already so large that this novel approach to group theory will lead to nothing novel in the field as a whole. The latter idea is more fruitful I believe. If it is possible to transform a dynamical system into a system satisfying the properties outlines above, then we can apply very strong ideas from group theory to the system.

Further extensions include including fitness levels to the populations and finding real-world applications of group-driven systems, both of which have been addressed, to some degree, in a companion paper to this, see Extensions of Population Dynamics of Algebraic Groups, .

9

J. Hofbauer, K. Sigmund, The Theory of Evolution and Dynamical Systems. Cambridge UP. 1988.

M. Hirsch, S. Smale, R.L. Devaney Differential Equations, Dynamical Systems & An Introduction to Chaos. Elsevier Academic Press. 2004.

J.A. Gallian, Contemporary Abstract Algebra. Houghton Mifflin. 2006.

C. Davidson-Pilon Extensions of Population Dynamics of Algebraic Groups Submitted to Journal of Theoretical Biology 2011.

## PyProcess Library

### An open-source library for stochastic processes in Python

PyProcess is an open source library meant for quick, useful and robust simulation of stochastic processes in the Python programming language. From the homepage:

PyProcess is a Python library for generating random processes. What is a random processes? A random process is a sequence of numbers, none of which are known with certainty. For example, a particular stock or commodity in financial markets are random processes, as their value in the future is random. Another example is the number of cars in a parking lot: you don't know how many cars will be present in the future. PyProcess is a tool used to generate possible realizations of the stock market, or number of cars in a parking lot, or any other random process.

#### PyProcess Online

For even an even quicker use, or to see a demo of what processes and options are available, one can use the PyProcess web-app

PyProcess is an open-source project, hence will never be completed 100%. That being said, I welcome any bug reports, assistance, or features that one would like to see added.

'

# Cam Davidson-Pilon

## Altruistic Programmer

Specifically, I love to code. More specifically, I love to code tools that make my life, or others' lives, easier/more interesting/happier, especially when the original task is not even possible for humans (machine learning, web searching, etc.) I'm an advocate for open source technologies and tools like GitHub (that make open source cool).

The langauges and tools I am most familiar with are:

1. #### Python

I've been coding in Python for 5 years, and consider myself a Python enthusiast. I am very experienced in the many sides of Python: i) statistical and computing work, ii) web technologies, and iii) as the server's glue. I have contributed to a number of open-source Python projects and am the main author of the repository Bayesian Methods For Hackers: Using Python and PyMC, written in the IPython Notebook format.

I have been to a few International PyCons, and attended the Advanced Scientific Computing in Python (2012)

2. #### Matlab

If Python is running too slow to move large matrices around, I switch to MATLAB. I've been using MATLAB for 5 years, and know when to use it and know when not to use it. I've created some interesting financial apps using (the suprisingly good) MATLAB GUI-DE.

3. #### Javascript (including jQuery and data vis. libraries)

My personal websites's subway system, http://wwww.camdp.com is written in Javascript, and so are a few other projects I have worked on. I like Javascript.

4. #### Linux and Windows enviroments

I'm comfortable with both, and can transition between the two quickly (though I really prefer Linux.)

5. #### MySQL and Redis

I am using Redis for some large-scale jobs, and I think it's great!

6. #### HTML(5)/CSS, R, Perl, Excel, Git, LaTeX

all tools I use to get the job done.

I should also mention I am learning/experimenting/fighting with Scala, MongoDB and Hadoop.

I'm on GitHub at CamDavidsonPilon.

## Statistician

My academic background is mathematics and statistics, with applications to finance and biology(exclusively, much to my disappointment). I graduated from the University of Waterloo, 2012, with a Master's Degree in Quantitative Finance, and graduated from Wilfrid Laurier University with a BSc in Mathematical Finance and Biology.

I have experience in the following:

• predictive analytics,
• machine-learning,
• time series modelling,
• data cleaning/wrangling,
• Bayesian methods,
• A/B and MAB testing,
• and data visualizations and web-based interfaces.

I believe that statistics is uninteresting without computers and novel applications. This motivates my interest in Bayesian statistics and machine learning. I've completed some interesting projects that combine these two fields (see my blog, http://www.camdp.com/blogs for details):

Aside from the open source and one-the-side projects, below is my more formal experience. Starting from the most recent:

1. #### Canadian Pension Plan Investment Board: Quantitative Analyst

May 2012 - Current: The CPPIB is Canada's largest pension fund, controlling and investing over 160 billion dollars.

• Create and implement new trading strategies based on market dislocations or statistical patterns. We use machine-learning algorithms and predictive statistical models of time series to generate trades.

• Developed a web-based GUI to display real-time analytics about the market.
• Create efficient infastructure to capture and store market real-time data.
1. Tools: Python, Redis, Linux/Windows, MATLAB, SQL, C++, Bloomberg, Excel, Javascript
2. Techniques: data visualization, machine-learning, data scrapping, model creation and validation.
2. #### Advanced Scientific Programming in Python: Participant

September 2012: An amazing one-week program based on Python's numerical power.

1. Tools: Python, IPython, Linux
2. Techniques: data viz, parallel programming, paired programming, Cython, memory considerations
3. #### Graduate Teaching Assistant at University of Waterloo

September 2011-December 2012: (Tried to) inspire undergraduate in differential equations and linear algebra.

4. #### Math in Moscow: Student

September 2011-December 2011: an international math program for invited students to study mathematics in Moscow, Russia.

1. Techniques: calculus on manifolds, advanced linear algebra, group theory, Russian Language
5. #### Undergraduate Researcher at Fields Institute

Summer 2011: Part of an international program that invites students to work closely with researchers at the Fields Institute for Research in Mathematical Sciences. I worked on epidemiology and evolutionary dynamics.

1. Techniques: probability, dynamical systems, evolutionary models, game theory.

Summer 2011: Worked with Dr. Roman Makarov on pricing exotic financial derivatives through Monte Carlo methods. Started development on PyProcess.

Summer 2010: Worked with Dr. Manuel Santoprete on the N-body problem.

## Contact me

I am a very pleasant and excited person to be around. I like dogs, biking, and coffee. I love science, hacking, and making people unexpectedly happy. As a student of evolution, I am constantly trying new experiments. Most fail, but then they don't.

I can be reached at cam.davidson.pilon@gmail.com. Thanks for taking the time to consider me ;)

Many of my projects involve hacking on the Twitter API and using said API to construct games, re-tell stories or otherwise just troll people. Check out some of my Twitter related projects to the right.

Twitter, if you are seeing this, I'd love to hack on your end. Please allow me an interview for a data analytics position. So much of my data and research involves you guys. Also, it's so cool you visited my site.

## Twittxor

Twittxor is a Twitter-based game that challenges a user's knowledge of the people they follow on Twitter. The best way to explain it is to actually just play it, so click below to visit the game.
It was built in Django/Python with the assistance of python-twitter. The code for the web app is available on GitHub.

I built this game at an overnight UWaterloo hackathon. Note: My explainations can be so vague on the page (I just assume the UI is so intuitive that the game explains itself haha).

@EnglishTeach85 - all she wants to do is love and troll.
@My6thGradeNovel - The shittiest writing I've ever done.
@HootBack - Tweet to me, @Hootback, for an anonymous tweet from the previous tweeter.

## More Projects

### Probablistic Programming and Bayesian Methods for Hackers

A book I am main author of introducing Bayesian methods for the non-mathematical. Awesome stuff! See the Subway station on the North of the map.

### Responsive art project (unnamed)

I'm designing a kinetic-responsive art project that will display a chaotic system in response to my phone's movements.

### Interactive Subway maps

I've got a great library to build subway maps [1], [2]. Now what?

### jPattern

typing password into mobile devices is a pain. What if you could swipe in your password for mobile sites? Check out my in development jPattern test.

# Probabilistic Programming and Bayesian Methods for Hackers

### Using Python and PyMC

Bayesian method is the natural approach to inference, yet it is hidden from readers behind chapters of slow, mathematical analysis. The typical text on Bayesian inference involves two to three chapters on probability theory, then enters what Bayesian inference is. Unfortunately, due to mathematical intractability of most Bayesian models, the reader is only shown simple, artificial examples. This can leave the user with a so-what feeling about Bayesian inference. In fact, this was the author's own prior opinion.

After some recent success of Bayesian methods in machine-learning competitions, I decided to investigate the subject again. Even with my mathematical background, it took me three straight-days of reading examples and trying to put the pieces together to understand the methods. There was simplely not enough literature bridging theory to practice. The problem with my misunderstanding was the disconnect between Bayesian mathematics and probabilistic programming. That being said, I suffered then so the reader would not have to now. This book attempts to bridge the gap.

If Bayesian inference is the destination, then mathematical analysis is a particular path to it. On the other hand, computing power is cheap enough that we can afford to take an alternate route via probabilistic programming. The path is much more useful, as it denies the necessity of mathematical intervention at each step, that is, we remove often-intractable mathematical analysis as a prerequisite to Bayesian inference. Simply put, this computational path proceeds via small intermediate jumps from beginning to end, where as the first path proceeds by enormous leaps, often landing far away from our target. Furthermore, without a strong mathematical background, the analysis required by the first path cannot even take place.

Probabilistic Programming and Bayesian Methods for Hackers is designed as a introduction to Bayesian inference from a computational/understanding-first, and mathematics-second, point of view. Of course as an introductory book, we can only leave it at that: an introductory book. For the mathematically trained, they may cure their curiousity this text generates with other texts designed with mathematical analysis in mind. For the enthusiast with less mathematical-background, or one who is not interested in the mathematics but simply the practice of Bayesian methods, this text should be sufficient and entertaining.

The choice of PyMC as the probabilistic programming language is two-fold. As of this writing, there is currently no central resource for examples and explanations in the PyMC universe. The official documentation assumes prior knowledge of Bayesian inference and probabilistic programming. We hope this book encourages users at every level to look at PyMC. Secondly, with recent core developments and popularity of the scientific stack in Python, PyMC is likely to become a core component soon enough.

PyMC does have dependencies to run, namely NumPy and (optionally) SciPy. To not limit the user, the examples in this book will rely only on PyMC, NumPy and SciPy only.

## Examples from the book:

1. Infering human behaviour from SMS message rates, Chapter 1.
2. Solving the Price is Right Showdown, Chapter 5.
3. Implementing Kaggle winning solutions, Chapter 5.
4. Exploring Github's social datasets, Chapter 10.
5. Aerospace data, specifically the Challenger Spacecraft explosion, Chapter 2.
6. Financial models wth non-linear payoffs, Chapter 5.

## Projects

### Probablistic Programming and Bayesian Methods for Hackers

A book I am main author of introducing Bayesian methods for the non-mathematical. Awesome stuff! See the Subway station on the North of the map.

### Interactive Subway maps

I've got a great library to build subway maps [1], [2]. Now what?

### jPattern

typing password into mobile devices is a pain. What if you could swipe in your password for mobile sites? Check out my in development jPattern test.

### Kaggle Competitions / Machine Learning posts

Kaggle.com is a site that provides companies and researchers with the global data science department. They host machine learning competitions for professional and amateur data scientist and machine-learnist to attempt, and winners receive sometimes quite large prizes (from \$500 to possibly \$3 million). I've been attempting a few competitions I found interesting, and overall I am doing well. More importantly I'm learning what doesn't work, and how to generalize to solve other data science problems. I guess one can call this human-learning =\

Similarly, I've been creating really nice machine learning posts/tutorials. There are more mathematical than others, but always have a nice example to demonstrate the subject matter.

### This site

This site is always a work in progress. This is currently the second implementation of my personal we site, the previous being the now dead 70percetfatfree.com. If you like the interactive subway component, you can download the javascript code from my Github account to build you own.

### Twittxor!

During a hackathon, I put together a fun little Twitter game, Twittxor. Soon to go viral. BTW, if you know any comp sci or mathematics, the name Twittxor is a concatenation of Twitter and XOR (exclusive-or), which describes the game well.

### PyProcess

I'm making I made a nice online graphical interface for exact Simulation of Stochastic Processes via Python (see below) using Django .

### The Golden Retrieber

The only algorithm in the world that tries to find Justin Bieber, introducing The Golden Retrieber. This was a project for a stat. learning class, but I will hopefully evolve into a web app!

### OWO: One Week Of

OWO is an attempt to pertubate my mental understanding into a new, higher state by exploring my own, and society's, pyschology, physiology, energy, prejudices, biases, spirituality, motivations, affections, all of it. Keep a close eye on this project.

### PyProcess: Exact Simulation of Stochastic Processes via Python

The project PyProcess is a Python implementation of the research I did on exactly simulating stochastic processes. With the PyProcess library, you can exactly simulate many diffusion processes, jump processes (finite and infinite activiy) and combinations of processes. Here is a link to the Google project's Github's main page and the documentation. Please abuse my code.

### Marketing Director and Webmaster

I was the marketing director and webmaster of the UW Cabaret, a small and terrific cabaret troupe. Check out our sweet website.

### AMMCS 2013

Webmaster for the conference.

### AMMCS 2011

To celebrate their centennial year, Wilfrid Laurier is hosting the 2011 Applied Mathematics, Modeling and Computational Science Conference. The conference is held between July 25th to the 29th. I, as I have too much free time, volunteered to help I was recruited to create the Book of Abstracts for the conference. It took me 100+ volunteer hours, so I might as well show if off. You can view it below:

2011 AMMCS Book of Abstracts

I used Python and 14 million leaked passwords to create a pretty cool machine-learning model of how humans create passwords.

## Github

Visit my github account [here]

## Home

1. Press and hold SHIFT and navigate the subway lines with your arrow keys. If your L33T-gamer, you can also use your WASD keys.
2. You can use your mouse to click on the different stations.
You can also drag and drop the subway stations to create new maps.

### Who am I?

My name is Cam Davidson-Pilon. I spend my time on awesome subjects like machine learning, coding Twitter trolls, web design, data science and biology. I do stats consulting at statly.ca.

## Research

### Machine and Statistical Learning

"There are wavelengths that people cannot see, there are sounds that people cannot hear, and maybe computers have thoughts that people cannot think."
-R. Hamming

Machine learning has really taken over my time. With huge web-inspired data sets becoming more and more available over the past decade, it seems to be taking over everyone's time.

Also check out my blog, where I discuss and practice with common/rare machine-learning algorithms.

### Evolutionary Systems and Biology

"A nest, like a bird, is a gene's way of making another gene." -R.Dawkins

In biology I study population dynamics, game theory and evolution, disease modeling (WITH stochastics) and applications to genetic algorithms. I recently started investigating host-parasite dynamics with sex. I believe that many sexual species' immune systems have evolved a quasigroup-like structure.

### Probability and Finance

"Don't sell them 30% fat, sell them 70% fat free."-N.Taleb