TypeError: ufunc ‘subtract’ did not contain a loop with signature matching types dtype(‘

I got the same error, but in my case I am subtracting dict.key from dict.value. I have fixed this by subtracting dict.value for corresponding key from other dict.value.

cosine_sim = cosine_similarity(e_b-e_a, w-e_c)

here I got error because e_b, e_a and e_c are embedding vector for word a,b,c respectively. I didn’t know that ‘w’ is string, when I sought out w is string then I fix this by following line:

cosine_sim = cosine_similarity(e_b-e_a, word_to_vec_map[w]-e_c)

Instead of subtracting dict.key, now I have subtracted corresponding value for key

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)