Random_mini_batches - Questions about the hint

Hi,

I just passed the “Exercice 2: random_mini_batch” but there is something I don’t get.
We get the following hint

The implemented hint is

nb_exemples_final_batch = (m - mini_batch_size) * math.floor(m / mini_batch_size )

but I don’t use this at all.

I mean for getting the last mini_batch I use the num_complete_minibatchs along with the mini_batch size for getting all the last exemples…

It is logical and it works.

Did I miss something ?

Thank

Welcome to the community.

I mean for getting the last mini_batch I use the num_complete_minibatchs along with the mini_batch size for getting all the last exemples…

That should work. And, that is exactly same as my implementation. :slight_smile:
There are multiple ways to implement a concept.

So, what is your problem ?

Thank for your answer,
I did not get the way to use the following:

nb_exemples_final_batch = (m - mini_batch_size) * math.floor(m / mini_batch_size )

when I want to use this, I don’t get all the test passed…

nb_exemples_final_batch = (m - mini_batch_size) * math.floor(m / mini_batch_size )

This must be,

nb_exemples_final_batch = (m - mini_batch_size * math.floor(m / mini_batch_size ))

Wow indeed… i did not pay attention to the operation order. Thank you !