Added Training logic for perceptron.