Generalization from correlated sets of patterns in the perceptron