I used to write this in Matlab: foo1 = zeros(1,100); foo2 = cell(1,100); for i = 1:100 [tmpFoo1, tmpFoo2] = foo ( X ); foo1(i) = tmpFoo1; foo2{i} = tmpFoo2; end This was until I realized you can write: foo1 = zeros(1,100); foo2 = cell(1,100); for i = 1:100 [foo1(i), foo2{i}] = foo ( X […]

## Understanding the Metropolis Hasting algorithm - A tutorial

The Problem Say you want to evaluate the expectation of a function over a random variable \(E[f(x)] = \int p(x)f(x)dx\), or perhaps find the max of a probability distribution, typically the posterior, \(\arg \max p(x|y)\), where calculating the derivate is intractable since it depends on some feature that comes from some algorithm or some unknown […]

## A short tutorial on Kernel Density Estimation (KDE)

The aim of Kernel Density Estimation(KDE) is: Given a set of \(N\) samples from a random variable, \(\mathbf{X}\), possibly multivariate and continuous, estimate the random variables probability density function(pdf) The univariate case To get a rough idea how one can think about the problem, we start out with a set of samples, \(X=[x_1,x_2,...,x_N]\), of a […]

## The psychology of debugging - the bias of complexity

Most of the times when you are writing code you are make mistakes either in the structure or in the specific code. These mistakes become bugs that sometimes eat up a lot of time to diagnose. Once diagnosed, bugs are usually easy to fix unless there is a big structural mistake, which makes you, rewrite […]

## The start-up evangelic

Attended the Stockholm Start-up Day 2013 event. It was really fun and the event was well organized with a good flow. It is great what people are trying to do for Swedish entrepreneurship. Not that there is a lack of really good entrepreneurs in Sweden, but the general mindset of most people is still to get a […]

## Partially fixing numerical underflow for mixture models

In a mixture model the probability of an event \(x\) is written \(P(x=X) =\sum_{i}\pi_{i}P_{i}(x=X) \), where \(\pi_{i}\) is the probability of the point belonging to mixture \(i\) and \(P_{i}(x=X) \) is the probability of the event \(x=X\) in the \(i\)-th mixture. The problem is usually that the \(P_i\) are small which makes underflow happen when […]

## Google can keep Keep....

I used to be a Google fanboy. However the disbanding of the Google Reader together with a bunch of thoughts on it here [1][2][3] just to mention a few, left me thinking about how I treat my personal data. It also made me think about how much I rely on free services in general which […]

## How to manage a (paper) deadline - 9 rules (to rule them all)

The last couple of weeks have been fraught with a paper deadline. My second one. Times have been stressful. The paper involved starting up from scratch, learning a new programming language, and how to work a robotic arm all in less than one and a half month. One of the realizations I had was that setting up […]

## Friday secrets

"Harry, I’m going to let you in on a little secret. Every day, once a day, give yourself a present. Don’t plan it, don’t wait for it, just let it happen. It could be a new shirt at the men's store, a catnap in your office chair or two cups of good hot black coffee."