W2 Exercise 2

Ok, 2 hours later, I give up. I don’t know how to iterate through:

for k in range(0, num_complete_minibatches):

Any assistance would be greatly appreciated. Thanks.

Using shuffled_X and shuffled_Y:

  • You will index inside a pair of square brackets, using two parameters (because it’s a 2D matrix).
  • The first index is going to be a colon, because you want all of the rows.
  • The second index is going to be a range of the form “q:r”, where ‘q’ is some multiple (k) of the batch size, and ‘r’ is “batch size” samples later.

Hi, thanks for getting back to me…I understand the syntax within the brackets well, it’s the variables I’m having trouble with.

The two data variables are shuffled_X and shuffled_Y.

The variables you use to compute the indices are k and mini_batch_size. You also use some multiplication and addition.

I’m referring to this portion of Step 2.

That what I’ve done, I’ve tried everything I can think of. Maybe the 2nd part in the if statement is wrong. I wrote those lines exactly as the equation was written in the instructions.

Check your private messages.