Multilayer perceptron in python