Added mechanism to train the neural network.

The training methodology is still in early stages.