ex4, Implementing back propagation algorithm