21st Century Problems

The technological challenges, and achievements, of the 20th Century handed society powerful tools. Technologies like nuclear power, airplanes & automobiles, the digital computer, radio, internet and imaging technologies to name only a handful. Each of these technologies had disrupted the system, and each can be argued to be Black Swans (à la Nassim Taleb). In fact, for each technology, one could find a company killed by it, and a company that made its billions from it.

What these technologies have in common is that are all deterministic engineering solutions. By that, I mean they have been created by techniques in mathematics, physics and engineering: often being modeled in a mathematical language, guided by physics' calculus and constrained and brought to life by engineering. I argue that these types of problems, of modeling deterministically, are problems that our father's had the luxury of solving.

The universe of all problems

Consider the universe of all problems. It is a large universe, no doubt. For simplicity, think of it as a three dimensional space, though in reality it is infinite-dimensional. The sub-space of all problems that can be solved by modeling deterministically, like building a bridge or modeling an airplane, constitute a line (or higher-dimensional equivalent of a line if you wish) in our three dimensional space. In mathematics, a line in 3-D space has measure 0, essentially its contribution to filling the space is negligible.

The problems we solved in the 20th Century, like flight, radio and digital computers, lie on this line. Using our current mathematics and engineering knowledge, we are reaching the limits of exploring that line: after all, the easy problems have already been solved (this bring to mind the tautology "Science is hard because all the easy problems are solved"). What's undiscovered on that line is still much, but major progression has slowed considerably (see previous sentence). Improvements are marginal.

What I am arguing is that our previous problem-solving steps of 1. model, 2. apply mathematics 3. ??? 4. profit does not have the same power as it use to have when applied to current day, and future, problems. We need to, and are starting to, explore problems off of this measure-0 line, like the red dot in the figure above. So, if this line characterizes all deterministic modeling problems, what problem might lie off this line? Statistical problems .

21st Century problems are statistical problems

Statistical problems describe the space we haven't explored yet. Statistical problems are not new: they are likely as old as deterministic problems. What is new is our ability to solve them. Spear-headed by the (constantly increasing) tidal wave of data, practitioners are able to solve new problems otherwise thought impossible. Consider the development of a spellchecker: in a deterministic approach, an algorithm for spell checking would have needed to incorporate context and complicated ideas from the language's grammar (I shutter at the nested if statements ), unique only up to that language; whereas a statistical approach can be written in under 20 lines. The difference between the two approaches is that the latter has taken advantage of the presence of a large corpus of text -- a very lenient assumption.

This isn't another big data article, but its hard underestimate, let along imagine, what we will be doing with these casual data sets. Fields like medicine, that previously relied on small sample sizes to make important one-size-fits-all decisions, will evolve into a very personal affair. By investigating traffic data, dynamic solutions can be built that mimic past successes. Aided by machine learning, specifically recommendation engines, companies can invoke desires never previously thought about in our minds. Ideas like multi-armed bandits will motivate UI and AI development.

What is a solution to a statistical problem?

Of course, there is a tradeoff. To speak of solving a statistical problem is silly. Whereas in our 20th Century past, we either solved the deterministic problem or did not, i.e. find or did not find a solution given the physical and engineering constraints, in statistical problems we are subject to some fraction of failure (hence why we don't build probabilistic bridges). This can be described by another visualization. The space of deterministic engineering problems can be found lying on the ends of the unit interval $[0,1]$. A 1 represents a problem that can be, or is, solved completely, eg: we successfully designed a method of flight. The space in between 0 and 1 is represented by statistical problems. For example, spell checking cannot be solved in the traditional sense, but it can be accurate 95% of the time. Harder statistical problems are those that involve reflexivity, that is your actions will affect the outcome (problems like the stock market and ad-targeting, where consumers can become desensitized to your optimized ad). Finally, problems that are unsolvable using current science and technology are assigned to 0.

Have we made any 21st Century breakthroughs yet?

The 20th Century breakthroughs were not breakthroughs at the time of their discoveries, minus a few exceptions. The technologies took years to percolate through society, and only after they became cheap enough for public consumption. Therefore, if we were to ask if we have already invented any breakthrough technologies of the 21st Century, we should search liberally through what we have done. I would suggest that yes, we have made a breakthrough: quality information search. Tech giants like Google and Microsoft are working on these technologies, but the are still in their infancy. Furthermore, this technology is the most naive technology given our data supply. Imagine you were the world's first librarian, and you have just received thousands of books. The first, and most naive, thing you would do is organize the books, i.e. make queries of the books easier. Returning to the present, we are at this stage where we have overcome our own data-indexing problem. In fact, we have gone a step further, and we can not only return all results, but damn good results too. Imagine an alternative internet that may have occurred where you browsed by selecting more and more specific topics from accordion menus until you reached a desired webpage -- this is a possible realization of the internet organization that luckily did not occur.

Conclusion

I am sticking my neck out, but I should point out an error in my overall argument. Previous authors may have been saying that we are at the end of so-and-so technology for years, right before a big new breakthrough. I, of course, cannot imagine these breakthroughs (else it would exist), hence I underestimate future deterministic solutions. There are still great advances possible, teleportation and quantum computers come to mind, that will be classified as breakthrough deterministic tech.

Simply, I claim we will start to see novel technological uses of data to statistical problems that we cannot even fathom right now (who could have imagined nuclear power in a pre-nuclear society). These technologies will be as revolutionary as radar was to man. So, why haven't you picked up Bayesian Methods for Hackers yet?

Appendum

EDIT: I was probably too hasty in discounting possible ventures of new technologies. I think there is a second venture that compliments data-driven technological advances: the bio-tech industry. The fictional biotech I can think of now include nanobiotechnology, brain-machine interfaces and genetic engineering. Each of these techs, and probably all biotech advances, will produce massive amounts of data as a byproduct. This is why I said the data-driven tech and biotech will compliment each other.



Other articles to enjoy:

Follow me on Twitter at cmrn_dp


All Blog Articles

Generating exponential survival data

March 02th, 2014

TLDR: Suppose we interested in generating exponential survival times with scale parameter $\lambda$, and having $\alpha$ probability of censorship ( $0 < \alpha < 1$. This is actually, at least from what I tried, a non-trivial problem. Here's the algorithm, and below I'll go through what doesn't work to:

continue reading...


Deriving formulas for the expected sample size needed in A/B tests

December 27th, 2013

Often an estimate of the number of samples need in an A/B test is asked. Now I've sat down and tried to work out a formula (being disatisfied with other formulas' missing derivations). The below derivation starts off with Bayesian A/B, but uses frequentist methods to derive a single estimate (God help an individual interested in a posterior sample size distribution!)

continue reading...


lifelines: survival analysis in Python

December 19th, 2013

The lifelines library provides a powerful tool to data analysts and statisticians looking for methods to solve a common problem:

How do I predict durations?

This question seems very vague and abstract, but thats only because we can be so general in this space. Some more specific questions lifelines will help you solve are:

continue reading...


Evolutionary Group Theory

October 03th, 2013

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 reading...


Videos about the Bayesian Methods for Hackers project

August 25th, 2013

  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

    Video available here.
continue reading...


Warrior Dash 2013

August 03th, 2013

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


The Next Steps

June 16th, 2013

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 reading...


NSA Honeypot

June 08th, 2013

Let's perform an experiment.

continue reading...


21st Century Problems

May 16th, 2013

The technological challenges, and achievements, of the 20th century brought society enormous progress. Technologies like nuclear power, airplanes & automobiles, the digital computer, radio, internet and imaging technologies to name only a handful. Each of these technologies had disrupted the system, and each can be argued to be Black Swans (à la Nassim Taleb). In fact, for each technology, one could find a company killed by it, and a company that made its billions from it.

continue reading...


ML Counterexamples Pt.2 - Regression Post-PCA

April 26th, 2013

Principle Component Analysis (PCA), also known as Singular Value Decomposition, is one of the most popular tools in the data scientist's toolbox, and it deserves to be there. The following are just a handful of the uses of PCA:

  • data visualization
  • remove noise
  • find noise (useful in finance)
  • clustering
  • reduce dataset dimension before regression/classification, with minimal negative effect
continue reading...


Machine Learning Counterexamples Pt.1

April 24th, 2013

This will the first of a series of articles on some useful counterexamples in machine learning. What is a machine learning counterexample? I am perhaps using the term counterexample loosely, but in this context a counterexample is a hidden gotcha or otherwise a deviation from intuition.

Suppose you have a data matrix $X$, which has been normalized and demeaned (as appropriate for linear models). A response vector $Y$, also standardized, is regressed on $X$ using your favourite library and the following coefficients, $\beta$, are returned:

continue reading...


Multi-Armed Bandits

April 06th, 2013

Suppose you are faced with $N$ slot machines (colourfully called multi-armed bandits). Each bandit has an unknown probability of distributing a prize (assume for now the prizes are the same for each bandit, only the probabilities differ). Some bandits are very generous, others not so much. Of course, you don't know what these probabilities are. By only choosing one bandit per round, our task is devise a strategy to maximize our winnings.

continue reading...


Cover for Bayesian Methods for Hackers

March 25th, 2013

The very kind Stef Gibson created an amazing cover for my open source book Bayesian Methods for Hackers. View it below:

continue reading...


An algorithm to sort "Top" Comments

March 10th, 2013

Consider ratings on online products: how often do you trust an average 5-star rating if there is only 1 reviewer? 2 reviewers? 3 reviewers? We implicitly understand that with such few reviewers that the average rating is not a good reflection of the true value of the product.

This has created flaws in how we sort items. Many people have realized that sorting online search results by their rating, whether the objects be books, videos, or online comments, return poor results.

continue reading...


How to solve the Price is Right's Showdown

February 05th, 2013

Preface: This example is a (greatly modified) excerpt from the book Probabilistic Programming and Bayesian Methods for Hackers in Python, currently being developed on Github ;)

How to solve* the Showdown on the Price is Right

*I use the term loosely and irresponsibly.

It is incredibly surprising how wild some bids can be on The Price is Right's final game, The Showcase. If you are unfamiliar with how it is played (really?), here's a quick synopsis:

continue reading...


My favourite part of The Extended Phenotype

February 02th, 2013

To quote directly from the book, by Richard Dawkins:

continue reading...


The awesome power of Bayesian Methods - Part II - Optimizing Loss Functions

January 10th, 2013

Hi again, this article will really show off the flexibility of Bayesian analysis. Recall, Bayesian inference is basically being interested in the new random variables, $\Theta$, distributed by $$ P( \Theta | X ) \propto L( X | \Theta )P(\Theta )$$ where $X$ is observed data, $L(X | \Theta )$ is the likelihood function and P(\Theta) is the prior distribution for $\Theta$. Normally, computing the closed-form formula for the left-hand side of the above equation is difficult, so I say screw closed-forms. If we can sample from $P( \Theta | X )$ accurately, then we can do as much, possibly more, than if we just had the closed-form. For example, by drawing samples from $P( \Theta | X )$, we can estimate the distribution to arbitrary accuracy. Or find expected values for easily using Monte Carlo. Or maximize functions. Or...well I'll get into it.

continue reading...


Interior Design with Machine Learning

January 04th, 2013

While designing my new apartment, I found a very cool use of machine learning. Yes, that's right, you can use machine learning in interior design. As crazy as it sounds, it is completely legitimate.

continue reading...


The awesome power of Bayesian Methods - What they didn't teach you in grad school. Part I

December 27th, 2012

For all the things we learned in grad school, Bayesian methods was something that was skimmed over. Strange too, as we learned all the computationally machinery necessary, but we were never actually shown the power of these methods. Let's start our explanation with an example where the Bayesian analysis clearly simply is more correct (in the sense of getting the right answer).

continue reading...


How to bootstrap your way out of biased estimates

December 06th, 2012

Bootstrapping is like getting a free lunch, low variance and low bias, by exploiting the Law of Large numbers. Here's how to do it:

continue reading...


High-dimensional outlier detection using statistics

November 27th, 2012

I stumbled upon a really cool idea of detecting outliers. Classically, one can plot the data and visually find outliers. but this is not possible in higher-dimensions. A better approach to finding outliers is to consider the distance of each point to some central location. Data points that are unreasonably far away are considered outliers and are dealt with.

continue reading...


A more sensible omnivore.

November 17th, 2012

My girlfriend, who is a vegetarian, and I often discuss the merits and dismerits of being a vegetarian. Though I am not a vegetarian (though I did experiment with veganism and holistic diets during some One Week Ofs), very much agree that eating as much meat as we do is not optimal.

Producing an ounce of meat requires a surprising amount of energy, whereas it's return energy is very small. We really only eat meat for its taste. It is strange how often we, the human omnivores, require meat in a meal, less it's not a real meal (and we do this three times a day). And unfortunately, a whole culture eating this way is not sustainable.

I have often thought about a life without meat,

continue reading...


Kaggle Data Science Solution: Predicting US Census Return Rates

November 01th, 2012

The past month two classmates and I have been attacking a new Kaggle contest, Predicting US Census mail return rates. Basically, we were given large amounts of data about block groups, the second smallest unit of division in the US census, and asked to predict what fraction of individuals from the block group would mail back their 2010 census form.

continue reading...


Visualizing clusters of stocks

October 14th, 2012

One troubling aspect of an estimated covariance matrix is that it always overestimates the true covariance. For example, if two random variables are independent the covariance estimate for the two variables is always non-zero. It will converge to 0, yes, but it may take a really long time.

What's worse is that the covariance matrix does not understand causality. Consider the certainly common situation below:

continue reading...


Twitter Pyschopathy

October 08th, 2012

Released earlier was the research paper about predicting psychopathy using Twitter behaviour. Read the paper here.

continue reading...


UWaterloo Subway Map

September 22th, 2012

I think my thing with subway maps is getting weird. I just created a fictional University of Waterloo subway map using my subway.js library.

continue reading...


Sampling from a Conditional Markov Chain

September 15th, 2012

My last project involving the artificial creation of "human-generated" passwords required me to sample from a Markov Chain. This is not very difficult, and I'll outline the sampling algorithm below. For the setup, suppose you have a transition probability matrix $M$ and an initial probability vector $\mathbf{v}$. The element $(i,j)$ of $M$ is the probability of the next state being $j$ given that the current state is $i$. The initial probability vector element $i$ is the probability that the first state is $i$. If you have these quantities, then to sample from a realized Markov process is simple:

continue reading...


Modeling password creation

September 14th, 2012

Creating a password is an embarrassingly difficult task. A password needs to be both memorable and unique enough not to be guessed. The former criterion prevents using randomly generated passwords (try remembering 9st6Uqfe4Z for Gmail, rAEOZmePfT for Facebook, etc.), and the latter is the reason why passwords exist in the first place. So the task falls on humans to create their own passwords and carefully balance these two criteria. This has been, and still is, a bad idea.

continue reading...


Eurotrip & Python

August 13th, 2012

Later this month, my lovely girlfriend and I are travelling to Amsterdam, Berlin and Kiel. The first half of the trip we will be exploring the tourist and nontourist areas of Amsterdam and Berlin. I'm very excited as I get to spend time drinking and relaxing with my girlfriend. But then...

continue reading...


Turn your Android phone into a SMS-based Command Line

August 11th, 2012

One of my biggest pet peeves is not having my phone with me. This often occurs if the phone is charging and I need to leave, or I have forgotten it somewhere, or it is lost, or etc. I've created a partial solution.

continue reading...


Least Squares Regression with L1 Penalty

July 31th, 2012

I want to discuss, and exhibit, a really cool idea in machine learning, optimization and statistics. It's a simple idea: adding a constraint to an optimization problem, specifically a constraint on the sum, can have huge impacts on your interpretation, robustness and sanity. I must first introduce the family of functions we will be discussing.

The family of L-norm penalty functions, $L_p:R^d \rightarrow R$, is defined: $$ L_p( x ) = || x ||_p = \left( \sum_{i=1}^d |x_i|^p \right) ^{1/p} \;\: p>0 $$ For $p=2$, this is the familar Euclidean distance. The most often used in machine learning literature are the

continue reading...


Warrior Dash Data

July 25th, 2012

Last Sunday I competed in a pretty epic competition: The Warrior Dash. It's 5k of, well honestly, it's 5k of mostly hills and trail running. Plus spread throughout are some pretty fun obstacles. With only five training workouts un...

continue reading...


Subway.js

July 17th, 2012

The javascript code that creates and controls the subway map above is available on GitHub. You can build your own using the pretty self-explanatory code + README document. Imagine using the code in a school project or advertising...

continue reading...


Kernelized and Supervised Principle Component Analysis

July 13th, 2012

Sorry the title is a bit of a mouthful. Everyone in statistics has heard of Principle Components Analysis ( PCA ). The idea is so simple, and a personal favourite of mine, so I'll detail it here.

continue reading...


Python Android Scripts

July 05th, 2012

I am having a blast messing around with my new Android phone. It has Python! Currently I am playing with the sensors on the phone. Built-in is a light sensor, accelerometer, and an

continue reading...


Predicting Psychopathy using Twitter Data

July 03th, 2012

The goal of this Kaggle contest was to predict an individuals psychopathic rating using information from their Twitter profile. I was given the already processed data and psychopathic scores. This was the first Kaggle competition I entered, and certainly not the last! If you'll excuse me, I must begin my technical remarks on my solution:

continue reading...


CamDP++

July 03th, 2012

Camdp.com is my latest attempt to digitize myself. I tried to map the subway lines to mimic my life and work, with each subway line representing a train of thought. I hope you enjoy the continue reading...


Data Science FAQ

July 02th, 2012

What is data science? What is an example of a data set? What are some of the goals of data science? What are some examples of data science in action? continue reading...


(All Blog Articles).filter( Science )

Generating exponential survival data

March 02th, 2014

TLDR: Suppose we interested in generating exponential survival times with scale parameter $\lambda$, and having $\alpha$ probability of censorship ( $0 < \alpha < 1$. This is actually, at least from what I tried, a non-trivial problem. Here's the algorithm, and below I'll go through what doesn't work to:

continue...


Deriving formulas for the expected sample size needed in A/B tests

December 27th, 2013

Often an estimate of the number of samples need in an A/B test is asked. Now I've sat down and tried to work out a formula (being disatisfied with other formulas' missing derivations). The below derivation starts off with Bayesian A/B, but uses frequentist methods to derive a single estimate (God help an individual interested in a posterior sample size distribution!)

continue...


lifelines: survival analysis in Python

December 19th, 2013

The lifelines library provides a powerful tool to data analysts and statisticians looking for methods to solve a common problem:

How do I predict durations?

This question seems very vague and abstract, but thats only because we can be so general in this space. Some more specific questions lifelines will help you solve are:

continue...


Evolutionary Group Theory

October 03th, 2013

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...


21st Century Problems

May 16th, 2013

The technological challenges, and achievements, of the 20th century brought society enormous progress. Technologies like nuclear power, airplanes & automobiles, the digital computer, radio, internet and imaging technologies to name only a handful. Each of these technologies had disrupted the system, and each can be argued to be Black Swans (à la Nassim Taleb). In fact, for each technology, one could find a company killed by it, and a company that made its billions from it.

continue...


ML Counterexamples Pt.2 - Regression Post-PCA

April 26th, 2013

Principle Component Analysis (PCA), also known as Singular Value Decomposition, is one of the most popular tools in the data scientist's toolbox, and it deserves to be there. The following are just a handful of the uses of PCA:

  • data visualization
  • remove noise
  • find noise (useful in finance)
  • clustering
  • reduce dataset dimension before regression/classification, with minimal negative effect
continue...


Machine Learning Counterexamples Pt.1

April 24th, 2013

This will the first of a series of articles on some useful counterexamples in machine learning. What is a machine learning counterexample? I am perhaps using the term counterexample loosely, but in this context a counterexample is a hidden gotcha or otherwise a deviation from intuition.

Suppose you have a data matrix $X$, which has been normalized and demeaned (as appropriate for linear models). A response vector $Y$, also standardized, is regressed on $X$ using your favourite library and the following coefficients, $\beta$, are returned:

continue...


Multi-Armed Bandits

April 06th, 2013

Suppose you are faced with $N$ slot machines (colourfully called multi-armed bandits). Each bandit has an unknown probability of distributing a prize (assume for now the prizes are the same for each bandit, only the probabilities differ). Some bandits are very generous, others not so much. Of course, you don't know what these probabilities are. By only choosing one bandit per round, our task is devise a strategy to maximize our winnings.

continue...


An algorithm to sort "Top" Comments

March 10th, 2013

Consider ratings on online products: how often do you trust an average 5-star rating if there is only 1 reviewer? 2 reviewers? 3 reviewers? We implicitly understand that with such few reviewers that the average rating is not a good reflection of the true value of the product.

This has created flaws in how we sort items. Many people have realized that sorting online search results by their rating, whether the objects be books, videos, or online comments, return poor results.

continue...


My favourite part of The Extended Phenotype

February 02th, 2013

To quote directly from the book, by Richard Dawkins:

continue...


N is never large.

January 15th, 2013

continue...


The awesome power of Bayesian Methods - Part II - Optimizing Loss Functions

January 10th, 2013

Hi again, this article will really show off the flexibility of Bayesian analysis. Recall, Bayesian inference is basically being interested in the new random variables, $\Theta$, distributed by $$ P( \Theta | X ) \propto L( X | \Theta )P(\Theta )$$ where $X$ is observed data, $L(X | \Theta )$ is the likelihood function and P(\Theta) is the prior distribution for $\Theta$. Normally, computing the closed-form formula for the left-hand side of the above equation is difficult, so I say screw closed-forms. If we can sample from $P( \Theta | X )$ accurately, then we can do as much, possibly more, than if we just had the closed-form. For example, by drawing samples from $P( \Theta | X )$, we can estimate the distribution to arbitrary accuracy. Or find expected values for easily using Monte Carlo. Or maximize functions. Or...well I'll get into it.

continue...


The awesome power of Bayesian Methods - What they didn't teach you in grad school. Part I

December 27th, 2012

For all the things we learned in grad school, Bayesian methods was something that was skimmed over. Strange too, as we learned all the computationally machinery necessary, but we were never actually shown the power of these methods. Let's start our explanation with an example where the Bayesian analysis clearly simply is more correct (in the sense of getting the right answer).

continue...


How to bootstrap your way out of biased estimates

December 06th, 2012

Bootstrapping is like getting a free lunch, low variance and low bias, by exploiting the Law of Large numbers. Here's how to do it:

continue...


High-dimensional outlier detection using statistics

November 27th, 2012

I stumbled upon a really cool idea of detecting outliers. Classically, one can plot the data and visually find outliers. but this is not possible in higher-dimensions. A better approach to finding outliers is to consider the distance of each point to some central location. Data points that are unreasonably far away are considered outliers and are dealt with.

continue...


Visualizing clusters of stocks

October 14th, 2012

One troubling aspect of an estimated covariance matrix is that it always overestimates the true covariance. For example, if two random variables are independent the covariance estimate for the two variables is always non-zero. It will converge to 0, yes, but it may take a really long time.

What's worse is that the covariance matrix does not understand causality. Consider the certainly common situation below:

continue...


Twitter Pyschopathy

October 08th, 2012

Released earlier was the research paper about predicting psychopathy using Twitter behaviour. Read the paper here.

continue...


Sampling from a Conditional Markov Chain

September 15th, 2012

My last project involving the artificial creation of "human-generated" passwords required me to sample from a Markov Chain. This is not very difficult, and I'll outline the sampling algorithm below. For the setup, suppose you have a transition probability matrix $M$ and an initial probability vector $\mathbf{v}$. The element $(i,j)$ of $M$ is the probability of the next state being $j$ given that the current state is $i$. The initial probability vector element $i$ is the probability that the first state is $i$. If you have these quantities, then to sample from a realized Markov process is simple:

continue...


Least Squares Regression with L1 Penalty

July 31th, 2012

I want to discuss, and exhibit, a really cool idea in machine learning, optimization and statistics. It's a simple idea: adding a constraint to an optimization problem, specifically a constraint on the sum, can have huge impacts on your interpretation, robustness and sanity. I must first introduce the family of functions we will be discussing.

The family of L-norm penalty functions, $L_p:R^d \rightarrow R$, is defined: $$ L_p( x ) = || x ||_p = \left( \sum_{i=1}^d |x_i|^p \right) ^{1/p} \;\: p>0 $$ For $p=2$, this is the familar Euclidean distance. The most often used in machine learning literature are the

continue...


Kernelized and Supervised Principle Component Analysis

July 13th, 2012

Sorry the title is a bit of a mouthful. Everyone in statistics has heard of Principle Components Analysis ( PCA ). The idea is so simple, and a personal favourite of mine, so I'll detail it here.

continue...


Predicting Psychopathy using Twitter Data

July 03th, 2012

The goal of this Kaggle contest was to predict an individuals psychopathic rating using information from their Twitter profile. I was given the already processed data and psychopathic scores. This was the first Kaggle competition I entered, and certainly not the last! If you'll excuse me, I must begin my technical remarks on my solution:

continue...


Data Science FAQ

July 02th, 2012

What is data science? What is an example of a data set? What are some of the goals of data science? What are some examples of data science in action? continue...


(All Blog Articles).filter( Coding )

lifelines: survival analysis in Python

December 19th, 2013

The lifelines library provides a powerful tool to data analysts and statisticians looking for methods to solve a common problem:

How do I predict durations?

This question seems very vague and abstract, but thats only because we can be so general in this space. Some more specific questions lifelines will help you solve are:

continue...


An algorithm to sort "Top" Comments

March 10th, 2013

Consider ratings on online products: how often do you trust an average 5-star rating if there is only 1 reviewer? 2 reviewers? 3 reviewers? We implicitly understand that with such few reviewers that the average rating is not a good reflection of the true value of the product.

This has created flaws in how we sort items. Many people have realized that sorting online search results by their rating, whether the objects be books, videos, or online comments, return poor results.

continue...


How to solve the Price is Right's Showdown

February 05th, 2013

Preface: This example is a (greatly modified) excerpt from the book Probabilistic Programming and Bayesian Methods for Hackers in Python, currently being developed on Github ;)

How to solve* the Showdown on the Price is Right

*I use the term loosely and irresponsibly.

It is incredibly surprising how wild some bids can be on The Price is Right's final game, The Showcase. If you are unfamiliar with how it is played (really?), here's a quick synopsis:

continue...


Kaggle Data Science Solution: Predicting US Census Return Rates

November 01th, 2012

The past month two classmates and I have been attacking a new Kaggle contest, Predicting US Census mail return rates. Basically, we were given large amounts of data about block groups, the second smallest unit of division in the US census, and asked to predict what fraction of individuals from the block group would mail back their 2010 census form.

continue...


Visualizing clusters of stocks

October 14th, 2012

One troubling aspect of an estimated covariance matrix is that it always overestimates the true covariance. For example, if two random variables are independent the covariance estimate for the two variables is always non-zero. It will converge to 0, yes, but it may take a really long time.

What's worse is that the covariance matrix does not understand causality. Consider the certainly common situation below:

continue...


UWaterloo Subway Map

September 22th, 2012

I think my thing with subway maps is getting weird. I just created a fictional University of Waterloo subway map using my subway.js library.

continue...


Modeling password creation

September 14th, 2012

Creating a password is an embarrassingly difficult task. A password needs to be both memorable and unique enough not to be guessed. The former criterion prevents using randomly generated passwords (try remembering 9st6Uqfe4Z for Gmail, rAEOZmePfT for Facebook, etc.), and the latter is the reason why passwords exist in the first place. So the task falls on humans to create their own passwords and carefully balance these two criteria. This has been, and still is, a bad idea.

continue...


Eurotrip & Python

August 13th, 2012

Later this month, my lovely girlfriend and I are travelling to Amsterdam, Berlin and Kiel. The first half of the trip we will be exploring the tourist and nontourist areas of Amsterdam and Berlin. I'm very excited as I get to spend time drinking and relaxing with my girlfriend. But then...

continue...


Turn your Android phone into a SMS-based Command Line

August 11th, 2012

One of my biggest pet peeves is not having my phone with me. This often occurs if the phone is charging and I need to leave, or I have forgotten it somewhere, or it is lost, or etc. I've created a partial solution.

continue...


Subway.js

July 17th, 2012

The javascript code that creates and controls the subway map above is available on GitHub. You can build your own using the pretty self-explanatory code + README document. Imagine using the code in a school project or advertising...

continue...


Python Android Scripts

July 05th, 2012

I am having a blast messing around with my new Android phone. It has Python! Currently I am playing with the sensors on the phone. Built-in is a light sensor, accelerometer, and an

continue...


Predicting Psychopathy using Twitter Data

July 03th, 2012

The goal of this Kaggle contest was to predict an individuals psychopathic rating using information from their Twitter profile. I was given the already processed data and psychopathic scores. This was the first Kaggle competition I entered, and certainly not the last! If you'll excuse me, I must begin my technical remarks on my solution:

continue...


(All Blog Articles).filter( Awesome Stuff )

Videos about the Bayesian Methods for Hackers project

August 25th, 2013

  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

    Video available here.
continue...


Warrior Dash 2013

August 03th, 2013

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


The Next Steps

June 16th, 2013

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...


NSA Honeypot

June 08th, 2013

Let's perform an experiment.

continue...


21st Century Problems

May 16th, 2013

The technological challenges, and achievements, of the 20th century brought society enormous progress. Technologies like nuclear power, airplanes & automobiles, the digital computer, radio, internet and imaging technologies to name only a handful. Each of these technologies had disrupted the system, and each can be argued to be Black Swans (à la Nassim Taleb). In fact, for each technology, one could find a company killed by it, and a company that made its billions from it.

continue...


Cover for Bayesian Methods for Hackers

March 25th, 2013

The very kind Stef Gibson created an amazing cover for my open source book Bayesian Methods for Hackers. View it below:

continue...


My favourite part of The Extended Phenotype

February 02th, 2013

To quote directly from the book, by Richard Dawkins:

continue...


Interior Design with Machine Learning

January 04th, 2013

While designing my new apartment, I found a very cool use of machine learning. Yes, that's right, you can use machine learning in interior design. As crazy as it sounds, it is completely legitimate.

continue...


A more sensible omnivore.

November 17th, 2012

My girlfriend, who is a vegetarian, and I often discuss the merits and dismerits of being a vegetarian. Though I am not a vegetarian (though I did experiment with veganism and holistic diets during some One Week Ofs), very much agree that eating as much meat as we do is not optimal.

Producing an ounce of meat requires a surprising amount of energy, whereas it's return energy is very small. We really only eat meat for its taste. It is strange how often we, the human omnivores, require meat in a meal, less it's not a real meal (and we do this three times a day). And unfortunately, a whole culture eating this way is not sustainable.

I have often thought about a life without meat,

continue...


UWaterloo Subway Map

September 22th, 2012

I think my thing with subway maps is getting weird. I just created a fictional University of Waterloo subway map using my subway.js library.

continue...


Modeling password creation

September 14th, 2012

Creating a password is an embarrassingly difficult task. A password needs to be both memorable and unique enough not to be guessed. The former criterion prevents using randomly generated passwords (try remembering 9st6Uqfe4Z for Gmail, rAEOZmePfT for Facebook, etc.), and the latter is the reason why passwords exist in the first place. So the task falls on humans to create their own passwords and carefully balance these two criteria. This has been, and still is, a bad idea.

continue...


Eurotrip & Python

August 13th, 2012

Later this month, my lovely girlfriend and I are travelling to Amsterdam, Berlin and Kiel. The first half of the trip we will be exploring the tourist and nontourist areas of Amsterdam and Berlin. I'm very excited as I get to spend time drinking and relaxing with my girlfriend. But then...

continue...


Warrior Dash Data

July 25th, 2012

Last Sunday I competed in a pretty epic competition: The Warrior Dash. It's 5k of, well honestly, it's 5k of mostly hills and trail running. Plus spread throughout are some pretty fun obstacles. With only five training workouts un...

continue...


Subway.js

July 17th, 2012

The javascript code that creates and controls the subway map above is available on GitHub. You can build your own using the pretty self-explanatory code + README document. Imagine using the code in a school project or advertising...

continue...


CamDP++

July 03th, 2012

Camdp.com is my latest attempt to digitize myself. I tried to map the subway lines to mimic my life and work, with each subway line representing a train of thought. I hope you enjoy the continue...