I implemented a C++ pipeline for learning Fisher feature vectors using VLFeat since Matlab should be avoided whenever possible. Also I found the tutorials and API on the web page a bit too rudimentary when it comes to implementing things in C++. I managed to find Python bindings later, but which doesn't seem to be […]

# Uncategorized

## Benchmarking Python fancy indexing vs. taken

I recently discovered that fancy indexing is not that fast in Python. If you do a lot of it, it can eat up some valuable computational time. So I benchmarked the different approaches I know: Just extracting the vectors using a True-False vector Using the np.where command on the True-False vector Using the np.take command […]

## The Rayleigh Quotient and the Norm Constraint

This post will try to explain why in the optimization of the Rayleigh Quotient one constrains the norm of \(x\) to be \(\|x\| = 1\) Let's start with the definition, given a symmetric matrix, \(A\), the Rayleigh quotient is defined as a function \(R(x)\) from \(\mathbb{R}^{d}_{0}\) to \(\mathbb{R}\), \begin{equation} R(x) = \frac{x^T A x}{x^Tx} \end{equation} […]

## Deliver first, fix later

Came across this interesting talk where Adriel Wallick talks about creating 52 games in a year. The main take away to me was how the constraints of delivering a game per week made her have to deliver a new doable idea every week. Delivering these ideas made her realize the big difference between the awesome […]

## BubbleSort: Computer Science Zines

Came across this on Kickstarter. Awesome.

## Why Latex is broken and what needs to be fixed

Having programmed too much HTML and CSS gets your mindset gets warped; in the right direction. You start to believe religiously that code should be separated from layout, and that those two should be separated from the content. And then you are faced with LaTeX which according to latex-project.org LaTeX is not a word processor! […]

## On the Trick for Computing the Squared Euclidean Distances Between Two Sets of Vectors

Many times one wants to compute the squared pairwise Euclidean distances between two sets of observations. As always it is enlightening to look at the computation being done in the single case, between a vector, \(x\), and a vector, \(y\), \(||x-y||^2\). The computation for the distance can be rewritten into a simpler form, $$||x-y||^2 = […]

## Weird behaviour in Matlab parfor loops when using the random generator

It is always good to be careful when using random number generators. Things might not be as random as they seem. I came across on inconsistency when using parfor loops in Matlab. I wanted to generate random permutations of indices so that I could pick out a random training and test set from the data. […]

## Chaining function calls in Matlab

Matlab has a nice feature that lets you chain commands by treating functions as variables. This means that you can write: a = "foo"; b = feval(a,arg1,arg2,...) Now if we want to chain commands acting on the same input we can write: myfoos = cell{'foo1','foo2','foo3',...}; x = ... chainedFoosOnX = applyChain(x,operators); function x = […]

## Saving from inside a parfor loop in Matlab

If you call save from a parfor loop in Matlab, like this for example: parfor k=1:100 foo = exp(-k); save(['myfile',num2str(k),'.mat'],'foo'); end it will generate an error. I have not exactly figured out why this is but probably it has to do with the fluctuating nature of the foo variable inside the parfor loop. By calling […]