Skip to content

Commit

Permalink
overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
SkBlaz committed Aug 17, 2024
1 parent bf5701b commit 7498e80
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions outrank/algorithms/feature_ranking/ranking_cov_alignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@

def max_pair_coverage(array1: np.array, array2: np.array) -> float:
def hash_pair(el1, el2):
return el1 * 17 - el2
return (el1 * 1471343 - el2) % max_size

counts = np.zeros(max_size, dtype=np.int32)
tot_len = len(array1)
for i in range(tot_len):
identifier = hash_pair(array1[i], array2[i])
counts[identifier % max_size] += 1
counts[identifier] += 1

return np.max(counts) / tot_len


if __name__ == '__main__':

array1 = np.array([1,1,2,3,1,1,1,5] * 1000)
array2 = np.array([0,0,5,5,3,0,0,0] * 1000)
array1 = np.array([1,1,2,3,1,1,1,5] * 100000)
array2 = np.array([0,0,5,5,3,0,0,0] * 100000)
coverage = max_pair_coverage(array1, array2)
assert coverage == 0.5

0 comments on commit 7498e80

Please sign in to comment.