Simple neural network implementation in Python