Sparsely coded neural networks