Stacked autoencoder exercise from http://ufldl.stanford.edu/