Search code examples
neural-networkbackpropagation

How Backpropagation works?


I have a question on backpropagation algorithm which is used in Deep Learning.

How should I update the weights when we have n training samples?

  • Should I update the weights for each sample and then again update it by the next sample?
  • Or I should get the average of them and then use the average?

Please guide me what is the rational procedure.

Thanks, Afshin


Solution

  • They are both rational options.

    Both approaches are correct. They are respectively called "online" and "offline" learning.

    Online learning

    Online machine learning is used in the case where the data becomes available in a sequential fashion (excerpt of the definition on Wikipedia).

    Offline learning

    Offline or "batch" learning may be used when one has access to the entire training dataset at once. An advantage of using batch learning is the improved immunity to local optima, but this comes at the cost of increased cost of training the net (the network often requires additional backpropagation iterations).