Course 5, Week 1, Exercise 2 (sample) possible typo

For step 3, there is guidance given on how to use np.random.choice():

idx = np.random.choice(range(len(probs), p = probs))

I believe the second to last parenthesis should be placed earlier as follows:

idx = np.random.choice(range(len(probs)), p = probs)

…because the documentation for range() specifies input parameters as ‘start’ and ‘stop’, whereas np.random.choice() specifies an input parameter ‘p’

Hi, David.

Yes, I agree that what you point out is a mistake. The sad thing is that this is actually a recent “fix”. Here’s how it looked in the original version of the notebook:

idx = np.random.choice(range(len(probs), p = probs)

So it used to be that the parens didn’t even match. Now they match, but what they express is incorrect. Sigh. I’ll reopen the bug …

Thanks Paul, You all are doing great! These aren’t trivial problem sets and they typically work very smoothly

It is great to hear that the course is working well for you! Just to be clear on the roles and responsibilities here, the mentors can take no credit for the course materials. We are just fellow student volunteers who answer questions on the forums. We don’t work for Deeplearning.AI and can only file bugs and suggestions. It is Prof Ng and his team at Deeplearning.AI who created all these great courses and deserve the credit for the quality of the material. And they keep cranking out more new specializations all the time, so you’ll have other potential things to look at once you finish DLS. Onward! :nerd_face: