backpropagation algorithm in ruby