(threshold, b, r, xq)
| 17 | |
| 18 | # 由式(24)计算FN概率 |
| 19 | def _false_negative_probability(threshold, b, r, xq): |
| 20 | _probability = lambda t : 1 - (1 - (1 - (t/(1 + xq - t))**float(r))**float(b)) |
| 21 | if xq >= 1.0: |
| 22 | a, err = integrate(_probability, threshold, 1.0) |
| 23 | return a |
| 24 | if xq >= threshold: |
| 25 | a, err = integrate(_probability, threshold, xq) |
| 26 | return a |
| 27 | return 0.0 |
| 28 | |
| 29 | # 为使假阳性和假阴性概率的加权和达到最小,计算最佳参数 |
| 30 | def _optimal_param(threshold, num_perm, max_r, xq, false_positive_weight, |