Introduced activation function and training function to main loop

It's currently broken. I can't figure out how to change the training
function and then train the network.