Completed perceptron algo