Self-taught learning exercise from http://ufldl.stanford.edu/