Implement perceptron