Framework for the backpropagation algorithm