Fix deprecation warning on newer numpy

Similarity metric should be a float
This commit is contained in:
kris 2019-02-23 23:33:18 +00:00
parent e4174ed10b
commit e0ab30d074

View File

@ -8,9 +8,9 @@ import numpy as np
def bitmap_similarity(a1: np.array, a2: np.array) -> float:
"""Measure bitwise % similarity between two bitmap arrays"""
bits_different = np.asscalar(np.sum(np.logical_xor(a1, a2)))
bits_different = np.sum(np.logical_xor(a1, a2)).item()
return 1 - (bits_different / (np.shape(a1)[0] * np.shape(a1)[1]))
return 1. - (bits_different / (np.shape(a1)[0] * np.shape(a1)[1]))
class Bytemap: