WEEK 2 : Confusion about the matrix created from input data

Lets say I have a input data that looks like this
Then what would be the the matrix X ? will it be this 45 matrix
matrix a
or will it be this 5
4 matrix
matrix b

I think the first one is correct. then how this below representation holds ?

Let’s say m is the number of examples (input samples) and n is the number of features (age, salary, last loan, times defaulted; in your case). Now it is on us whether to make matrix X as m \times n matrix or n \times m. In your example, m is 5 and n is 4. Now it is your decision to make the matrix X as a 4 \times 5 matrix or as a 5 \times 4. Both are correct.

In the Deep Learning course, Prof. Andrew used the n \times m convention (meaning that X is 4 \times 5 matrix) and all the later calculation is according to it. The choice is yours. But all the later calculations should be compatible with your choice.


1 Like

Hello @Angshuman_Maity,

Saif has explained it. However, I wondered how the representation was not consistent with your first choice?


Thanks Saif. Understood. You are amazing and fast :slight_smile:

Actually, in prof Andrew’s explanation, the x (1) ( please read - x superscript 1 ) doesn’t mean variable x1, it is referring to the first row of input dataset.

Thank you @Angshuman_Maity. It’s great that you have understood it! Onward!


PS: I have also just watched that part of the video again. I believe that you have cleared the confusion now, but by any chance, just in case, if you watched it again and still found anything confusing, let me know the time mark and we can talk specifically on the line that confused you. If it is all clear now, then we are fine and let’s just move on :wink: