Problem with Exercise 10

My function from the previous exercise hash_value_of_vector(v, planes) has passed all tests. However, when it is called on by the next function make_hash_table(vecs, planes, hash_value_of_vector=hash_value_of_vector) it always returns an error

 23     # and true (equivalent to 1) if the sign is positive (1,10) shaped vector
 24     # if the sign is 0, i.e. the vector is in the plane, consider the sign to be positive

—> 25 for i in range(np.shape(sign_of_dot_product[0])[0]):
26 if sign_of_dot_product[0][i] < 0:
27 h.append(0)

IndexError: tuple index out of range

Please click my name and message your notebook as an attachment.

@Amana_L
When calling hash_value_of_vector inside make_hash_table the shape of v is (300,). But, your function expects v to be of shape (1, 300). You can use np.expand_dims or v.reshape to fix this.

1 Like