Building a neural network from scratch