C3_w1_ex1 failure


Filename: c3_w1_ex1

50/100Score: 50 of 100

Hide grader output

Grader output is incorrectly flagging the error for my find_closest_centroids() implementation. All my unit tests work for the same pass fine . I also implemented the second exercise in the assignment and am able to execute and get the final result of the assignment. I made 3 submissions early morning today thinking it was a glitch. All three failed. I then chatted with the online agent who suggested to clear cookies/cache. I did that and submitted a 4th time and i still get the same error during submission. See error below. It does not make sense. The error says return type should be class bool which is incorrect.

Code Cell UNQ_C1: Unexpected error (TypeError(“find_closest_centroids() got an unexpected keyword argument ‘centroids’”)) occurred during function check. We expected function find_closest_centroids to return type <class ‘bool’>. Please check that this function is defined properly.

Update: Chatted with Human agent today .I resubmitted the assignment using Safari based on agents recommendation. I was using Chrome for previous submissions. Sent screenshots of above error and also screenshot of the all unit tests for this passing. The agent reviewed the screen shots and recommended to get the help of moderators Here is the final response from the human agent - “Thank you for patiently waiting. In this case, I would highly suggest that you wait for a reply to your post in the Community so that the course staff and moderators can assist you accordingly.”

Appreciate any help!

Can you send the code of grader cell exercise 1 via personal DM. Click on my name and then message

Your log is basically telling you have recalled a function with an incorrect argument.

Coursera’s help center staff do not answer questions about the course materials.

All they can do is suggest you clear your cache and cookies and try a different browser - because their only responsibility is whether the course web pages load correctly.

Asking Coursera any technical questions is a waste of time.

Note that passing the tests in the notebook does not prove your code is perfect. The grader uses a different set of tests.


GRADED FUNCTION: find_closest_centroids

def find_closest_centroids(X, c):
Computes the centroid memberships for every example

    X (ndarray): (m, n) Input values      
    centroids (ndarray): (K, n) centroids

    idx (array_like): (m,) closest centroids


# Set k (number of centroids)
k = c.shape[0]

# You need to return the following variables correctly
idx = np.zeros(X.shape[0], dtype=int)

{moderator edit: code removed}
 ### END CODE HERE ###

return idx

Please do not post your code on the forum. That’s not allowed by the Code of Conduct.

Apologies. I thought it was shared via personal DM.

To use a personal message, you have to click on the person’s name, then use the “Message” button.

I was able to run the rest of the non-graded parts of the entire assignment successfully as well. The non-graded part depends on the graded exercises,

First issue from your code:

You have modified part of the assignment, by changing the parameter names.
I recommend you not do this. Only modify the part of the template that says “START CODE HERE”.

This is what the template code should look like.

That was the issue! Fixed it and the grading passed the exercise now. Thank you much!