Unsupervised learning of invariant representations