Formation of Representations in Neural Networks