backpropagation algorithm with scala