mirror of https://github.com/milvus-io/milvus.git
Resolve the warnings of case test_search_binary_tanimoto_flat_index (#18918)
Signed-off-by: “nico” <Nico_1986@163.com> Signed-off-by: “nico” <Nico_1986@163.com>pull/18975/head
parent
2570176fb2
commit
05c724ad6d
|
@ -575,7 +575,12 @@ def hamming(x, y):
|
|||
def tanimoto(x, y):
|
||||
x = np.asarray(x, np.bool)
|
||||
y = np.asarray(y, np.bool)
|
||||
return -np.log2(np.double(np.bitwise_and(x, y).sum()) / np.double(np.bitwise_or(x, y).sum()))
|
||||
res = np.double(np.bitwise_and(x, y).sum()) / np.double(np.bitwise_or(x, y).sum())
|
||||
if res == 0:
|
||||
value = 0
|
||||
else:
|
||||
value = -np.log2(res)
|
||||
return value
|
||||
|
||||
|
||||
def tanimoto_calc(x, y):
|
||||
|
|
Loading…
Reference in New Issue