first_mini_batch_X = shuffled_X[:, 0 : mini_batch_size]
I suppose Iβ am saying that every column of X will be renamed as mini_batch_size
second_mini_batch_X = shuffled_X[:, mini_batch_size : 2 * mini_batch_size]
what am I saying here?
Many thks
first_mini_batch_X = shuffled_X[:, 0 : mini_batch_size]
I suppose Iβ am saying that every column of X will be renamed as mini_batch_size
second_mini_batch_X = shuffled_X[:, mini_batch_size : 2 * mini_batch_size]
what am I saying here?
Many thks
Not any column is gonna renamed.
first_mini_batch_X = shuffled_X[:, 0:mini_batch_size]
means to select all rows of the matrix shuffled_X
and specific columns from 0 to (but not including) mini_batch_size
.
Similarly, second_mini_batch_X = shuffled_X[:, mini_batch_size : 2 * mini_batch_size]
means to select all rows of the matrix shuffled_X
and specific columns from mini_batch_size to (but not including) twice of mini_batch_size
.
For example, if mini_batch_size
is 64, then first_mini_batch_X has all the rows of shuffled_X and columns from 0 to 63. And, second_mini_batch_X has all the rows but columns from 64 to 127 (as 2 * 64 = 128).
Best,
Saif.
Saif, in the introduction of the exercise 2 is stated:
If the total number of examples is not a multiple of mini_batch_size=64
then there will be βπ /ππππ_πππ‘πβ_π ππ§π mini-batches with a full 64 examples, and the number of examples in the final mini-batch will be (πβππππ_πππ‘πβ_π ππ§πΓβπππππ_πππ‘πβ_π ππ§πβ)
If I write in the code
mini_batch_X= shuffled_X[:, int(m -mini_batch_size)* mini_batch_size :] it wonβt work
I have to do
mini_batch_X= shuffled_X[:, int(m /mini_batch_size)* mini_batch_size :]
why?
Thks
Why not do the math? Try it out. Put the values of m and mini_batch_size in both equations and compare the output.
I know that the math is correct
the definition conversely was stating m - min-batch_size end not m/min_batch-_size
am I wrong?
The below text is from the assignment:
"If the total number of examples is not a multiple of mini_batch_size=64
then there will be \left\lfloor \frac{m}{mini\_batch\_size}\right\rfloor mini-batches with a full 64 examples, and the number of examples in the final mini-batch will be \left(m-mini_\_batch_\_size \times \left\lfloor \frac{m}{mini\_batch\_size}\right\rfloor\right). "
[quote=βabdelkoudos, post:7, topic:348586β]
I need help and clarification concerning this part of the assignment please
first_mini_batch_X = shuffled_X[:, 0 : mini_batch_size]
Here by the indexing rules of numpy:
X[rows, cols] -> X[data_pts, features]
so thatβs mean that this code divide a mini batches from the features not from the data pts.
thanks
Sorry, but I think you are misinterpreting the way the data is arranged here. Prof Ng uses the columns as the βsamplesβ dimension, so the dimensions are X are features x samples
.
You can do it either way, so you just have to pay attention to how it is being done in each particular case.