The result of the equation de/db according to the explanation should be a vector not a single value. What is that I am doing wrong?

@paulinpaloalto can you please provide your input on the same?

@Alireza_Saei can you please review my question here?

Hi @mbojja

The output of `dedm`

is expected to be a vector, as it computes the partial derivatives for each training example. However, `dedb`

should be a scalar representing the average gradient across all training examples. Try using `np.sum(m*X + b - Y)`

instead of just `(m*X + b - Y)`

and let me know if that fixed the problem!

The formulas are:

\frac{dE}{dm} = \frac{1}{N} \sum_{i=1}^N (m \cdot x_i + b - y_i) \cdot x_i

\frac{dE}{db} = \frac{1}{N} \sum_{i=1}^N (m \cdot x_i + b - y_i)

Hope it helps! Feel free to ask if you need further assistance.

2 Likes