MCPcopy Create free account
hub / github.com/BIT-DataLab/LakeBench / _optimal_param

Function _optimal_param

join/LSH/datasketch/lshensemble.py:30–44  ·  view source on GitHub ↗
(threshold, num_perm, max_r, xq, false_positive_weight,
        false_negative_weight)

Source from the content-addressed store, hash-verified

28
29# 为使假阳性和假阴性概率的加权和达到最小,计算最佳参数
30def _optimal_param(threshold, num_perm, max_r, xq, false_positive_weight,
31 false_negative_weight):
32 min_error = float("inf")
33 opt = (0, 0)
34 for b in range(1, num_perm+1):
35 for r in range(1, max_r+1):
36 if b*r > num_perm:
37 continue
38 fp = _false_positive_probability(threshold, b, r, xq)
39 fn = _false_negative_probability(threshold, b, r, xq)
40 error = fp*false_positive_weight + fn*false_negative_weight
41 if error < min_error:
42 min_error = error
43 opt = (b, r)
44 return opt
45
46
47class MinHashLSHEnsemble(object):

Callers 2

_init_optimal_paramsMethod · 0.70
lshensemble.pyFile · 0.70

Calls 2

Tested by

no test coverage detected