Optional Lab: Multiple Variable Linear Regression - Week2

Hi everyone,I have a question about the optional lab in Week 2
can someone explain to me why we use dj_dw [j] in this code?
it shouldn’t be dj_dw [i].

Hi @Meraj_Rahbari ,

The index variable j is a count to the number of features up to n. Each example has n number of features. The index variable i is a count to the total number of examples, m.

The first ‘for’ statement is to loop through each example, and the second ‘for’ statement is to loop through every feature in that example.

1 Like

thank you for your help :pray::pray::pray: