No idea why C1_W4_Assignment; make_hash_table()

Hi there!

I can’t get passed for this make_hash_table(). And I don’t even know how I’m wrong.
I suspect it’s the implementation of calculating the hash value (h) but I really have no idea how I’m wrong. If there is anybody who has/had the same output as me, would you share with me how you solved it?
Thank you in advence

Cossy

The hash table at key 0 has 1351 document vectors
The id table at key 0 has 1351
The first 5 document indices stored at key 0 of are [3, 8, 16, 18, 29]

I confirmed it’s not because of num_buckets at least by checking if it’s correct with what somebody said in this question forum in the past.

Hey @Cossy,
It’s a little difficult to think about how to create an error in the function, to get the same output as yours. Can you please DM your code for the function to me?

Cheers,
Elemento

1 Like

I have exactly the same problem. Were you able to solve this?

I solved this problem!!! It was because in hashing function I was assigning a 0 in the h for the 0 values in “sign_of_dot_product”. I changed this so I assigned 1 to [0 and +1] and 0 for [-1]. It solved my problem.

2 Likes