In the second week’s programing assignment, it shows “Wrong values. It happens if the order of X rows(features) changes”. I don’t understand what does this error means and what’s the possible solution for it. Can someone help me? Thanks.

In order to really understand how this test works, you’d need to carefully study how the test case is constructed to understand why that “invariant” they are checking applies. But at a high level, the point is that the X sample matrices are arranged with each column being an individual sample. So when you form a minibatch, you are selecting a set of columns of X but leaving the rows untouched in each column. What the failure of that test is telling you is that you did not implement it that way: you must somehow also be rearranging the rows.

Hi, thanks for the suggestions. I think I figure out where goes wrong.

Basically, I downloaded and run the notebook on my local machine, and the test case encounter an integer overflow problem. Specifically, the `numpy`

sum will do arithmetic within 2^32 yet python arithmetic does not have such limitation.

Weirdly enough, the `numpy`

in Coursera notebook can do arithmetic within 2^64 and hence do not have such a problem. Maybe it’s due to a python or numpy version mismatch between my local computer & Coursera notebook.

Yes, all bets are off if you are not running on the course website. It would have been relevant to mention that earlier. There are tools you can use to make sure you duplicate the environment, but they are non-trivial to use and we do not have detailed instructions. Here’s a Discourse thread that at least points in the relevant direction. This is beyond the scope of the course, so you are on your own if that is the way you go.