Seeking help on C1M2 Exercise 2

I receive an output of [0], when the expected output is [743, 673, 626, 752, 326]
I’m not sure what I am doing wrong, and it very likely has everything to do with my limited (though growing) understanding of coding.

Here is my code:

START CODE HERE

… code removed …

### END CODE HERE ###

Any pointers would be greatly appreciated!

Please do not share your code on the forum. That is not allowed by the Code of Conduct.

Hopefully a mentor for that course will be able to reply soon.

Hi bennozaurus.

My recommendation for developing the aforementioned exercise is to follow everything indicated in the notebook’s hits.
The solution is framed within everything indicated in the hits.

I’m outlining each of the steps you should follow.

This is useless… I was following that, and I was still getting [0] as output. The issue for me was that I was using only one score from the cosine_similariy(…)[0].

This assignment needs revising for bugs and clarity. Exercise 1 had an uncessary comment to index the corpus which prevents passing the unit tests.

Thanks for your recommendations.

1 Like

Same issue. Getting the error: k of 5 is larger than the number of available scores, which is 1 (corpus size should be larger than top-k). Please set with a smaller k or increase the size of corpus.

If I set k=1, I get one index [0]

Never mind. I was able to figure this out.

1 Like