partial derivative for gradient descent

500 Views Asked by At

I'm going through this video to understand gradient descent.

This is the error equation:

$$error = \frac{1}{N} \sum_{i=1}^N (y_i - (mx_i + b))^2$$

where m =slope, b = intercept.

How are the partial derivatives with respect to m and b are calculated ? Please show all the intermediate steps.

$$ \frac{\partial}{\partial m} = \frac{2}{N} \sum_{i=1}^N -x_i (y_i - (mx_i + b))$$

$$ \frac{\partial}{\partial b} = \frac{2}{N} \sum_{i=1}^N - (y_i - (mx_i + b))$$