A post gives a formula for perceptron to update weights
I understand almost all the parts of it, except for the part $(y_i - \hat y_i)x_i$ where does it come from? Is it the gradient of some kind of loss function? If yes, what is the definition of the loss function?
The OP seems doesn't give the hypothesis, so that $\hat y_i = h(x_i)$
However, this hypothesis seems prevalent
\begin{align} \hat{y} &= sign(\mathbf{w} \cdot \mathbf{x} + b) \tag{1}\\ &= sign({w}_{1}{x}_{1}+{w}_{2}{x}_{2} + ... + w_nx_n + b) \\ \end{align}
where
$$ sign(z) = \begin{cases} 1, & z \ge 0 \\ -1, & z < 0 \end{cases} $$
How do I get $(y_i - \hat y_i)x_i$ from function (1)