Example code for a single layer perceptron