Finished generalized perceptron learning code.