Perceptron learning algorithm implementation