C1_W4_Assignment Exercise 11 Test failed

    ### START CODE HERE (REPLACE INSTANCES OF 'None' with your code) ###

    # loop through the subset of document vectors to consider
    for i, new_id in enumerate(new_ids_to_consider):
        
        if doc_id == new_id:
            continue

        # if the document ID is not yet in the set ids_to_consider...
        if new_id not in ids_to_consider_set:
            # access document_vectors_l list at index i to get the embedding
            # then append it to the list of vectors to consider as possible nearest neighbors
            document_vector_at_i = document_vectors_l[i]
            vecs_to_consider_l.append(document_vector_at_i)

            # append the new_id (the index for the document) to the list of ids to consider
            ids_to_consider_l.append(new_id)

            # also add the new_id to the set of ids to consider
            # (use this to check if new_id is not already in the IDs to consider)
            ids_to_consider_set.add(new_id)

    ### END CODE HERE ###


Any idea what is wrong in my code or how I can pass the test!!?
Thanks

Hi Farhat_rk,

From what I can tell there would appear to be an error in an earlier exercise. So you may want to check for that. You could also try to restart the kernel and run all cells anew.

I’ve done this many times, I passed the assignment without this exercise I don’t find any error, the test function not working well

Ok. Feel free to send me your notebook as an attachment to a direct mail so I can have a look.

Hi Farhat_rk, Were you able to resolve this issue? I am getting the same output and the test case isn’t getting through! Any kind of inputs would be helpful. Thanks!

I have similar problem with my notebook in the very last unit-test:

Fast considering 77 vecs
Wrong chosen neighbor ids.
Expected: [51, 2478, 105].
Got: [2478, 1876, 253].
Fast considering 153 vecs
Wrong chosen neighbor ids.
Expected: [992, 4750, 9486, 9101].
Got: [9486, 9101, 9074, 8992].
0 Tests passed
2 Tests failed

For example, if one compares tweets under ids 51 and 253, they look just the same, so i am pretty sure that here i deal with some problem in unit-test, not in my solution.

Checkout the results of unit-test debugging. The test is lacking a determinism. There are more than 3 vectors with cosine similarity with respect to target is maximal. Expected 3 vectors are among them. The test definitely requires fixing.

In regards to the above i am asking to rise my grade for the programming assignment in C1_W4 by 10 points (like if the last unit-tests was green).