# Batch gradient descent in Perceptron linear classifier

I'm learning about batch gradient descent for the Perceptron linear classifier and I'm confused about the update rule. On Wikipedia, it says that the update rule for batch gradient descent is $w := w - \alpha \sum_{i = 1}^{n} \nabla Q_i(w)$ where $\alpha$ is the learning rate.

Why is the gradient a sum and not an average of the gradients of each misclassified sample? I tried implementing the batch gradient descent update rule above and it seemed to make the error worse since the weights would update by a huge amount at each iteration. Instead, I tried $w := w - \alpha \frac{1}{n} \sum_{i = 1}^{n} \nabla Q_i(w)$ and the results were much better. Am I understanding the update rule incorrectly?

• The only difference between the two equations in the question is a factor of $\frac{1}{n}$ applied to the gradients. Gradients are a vector; multiplication by a positive scalar doesn't change a vector's direction but it does change its length. Therefore, we can conclude that the two update rules can be made equivalent by appropriately rescaling $\alpha$, either by $n$ or by $\frac{1}{n}$, respectively. – Sycorax Jan 30 '20 at 14:56