Fitting the perceptron to data