Generalization in a diluted neural network