I’m completing the final assignment but seem to have some strange issue on Exercise 6.
In cell “UNQ_C11”, when running test_vocabulary
I get an accuracy of 0, not the expected 0.557.
However, my code for all the other exercises has produced the expected output:
R_Train
has been obtained through training, with the loss descent up to iteration 375 showing as expected.
nearest_neighbor
function produces the expected output
get_matrices
function produces the
Also, the unit tests pass for test_vocabulary (even though the cell above produces the wrong result).
I’ve also added some debug steps in my test_vocabulary and the predictions do appear to all be wrong.
Any ideas on how to further investigate? I am at a loss as to what’s gone wrong and where.
Could you share screenshots of your debug steps?
or DM the code screenshots of
UNQ_C10 (UNIQUE CELL IDENTIFIER, DO NOT EDIT)
def test_vocabulary(X, Y, R, nearest_neighbor=nearest_neighbor):
via personal DM. Click on my name and then message.
Points you need to follow
- Check if prediction where recalled using numpy dot for x times r
- If you initialised number correct to zero
- if the loop through each row was recalled correctly as the index of the nearest neighbour of pred should include row[i]
4.under same loop check if index of nearest neighbour of pred is absolute equal to row i, then increment number correct by 1
- check if accuracy is number correct divided number of row in pred, i.e. len(pred)
Regards
DP
1 Like
Thanks Deepti, was working on it late, but looking at it with fresh eyes this morning it was a super obvious mistake - and your list of points helped me spot it quickly. I’d written X
instead of pred
in the parameters for the nearest_neighbour
2 Likes