implemented perceptron learning