| | 271 | log.info("previous score threshold:\t" + mc.getScoreThreshold()); |
|---|
| | 272 | // change the score threshold to one calculated from estimated true matches |
|---|
| | 273 | VectorTable vt = new VectorTable(mc); |
|---|
| | 274 | |
|---|
| | 275 | // get sorted list of results |
|---|
| | 276 | List<MatchResult> results = vt.getPossibleMatchResults(); |
|---|
| | 277 | Iterator<MatchResult> it = results.iterator(); |
|---|
| | 278 | double total = 0; |
|---|
| | 279 | MatchResult total_mr = null; |
|---|
| | 280 | double prev_total = 0; |
|---|
| | 281 | MatchResult prev_mr = null; |
|---|
| | 282 | while(it.hasNext() && total < true_matches){ |
|---|
| | 283 | MatchResult mr = it.next(); |
|---|
| | 284 | double d = mr.getTrueProbability() * total_pairs; |
|---|
| | 285 | prev_total = total; |
|---|
| | 286 | prev_mr = total_mr; |
|---|
| | 287 | total += d; |
|---|
| | 288 | total_mr = mr; |
|---|
| | 289 | } |
|---|
| | 290 | // choose total or prev_total, depending on which one is closer to estimated matches |
|---|
| | 291 | if(Math.abs(total - true_matches) > Math.abs(prev_total - true_matches)){ |
|---|
| | 292 | // use previous score as threshold |
|---|
| | 293 | mc.setScoreThreshold(prev_mr.getScore()); |
|---|
| | 294 | } else { |
|---|
| | 295 | mc.setScoreThreshold(total_mr.getScore()); |
|---|
| | 296 | } |
|---|
| | 297 | log.info("new score threshold:\t" + mc.getScoreThreshold()); |
|---|
| | 298 | |
|---|