C3_W1_KMeans_Assignment # UNQ_C1 AssertionError: Wrong values

C3_W1_KMeans_Assignment

UNQ_C1

GRADED FUNCTION: find_closest_centroids (runs with no errors)

However, when running a protected cell, select an initial set of centroids (3 centroids).

Actual output:

first three elements in idx are: [0, 0, 0]

AssertionError Traceback (most recent call last)
in
11 from public_tests import *
12
—> 13 find_closest_centroids_test (find_closest_centroids)

~/work/public_tests.py in find_closest_centroids_test(target)
39 assert type(idx) == np.ndarray, “Wrong type”
40 assert idx.shape == (len(X),), f"Wrong shape. Expected: {(len(X),)} got: {idx.shape}"
—> 41 assert np.allclose(idx, [0, 0, 0, 1, 1, 1]), “Wrong values”
42
43 # With 3 centroids

AssertionError: Wrong values

Expected Output:

First three elements in idx are [0 2 1]

Could you DM your codes. Do not post your codes here. Click on my name and then message.

Issue was incorrect for loop placement and subsequent