Return the current (scaled) score boost for neighbours. Return Value: Scaled neighbour score boost
()
| 299 | num_neighbours_mismatched = 0 |
| 300 | |
| 301 | def getNeighbourScore(): |
| 302 | """Return the current (scaled) score boost for neighbours. |
| 303 | |
| 304 | Return Value: |
| 305 | Scaled neighbour score boost |
| 306 | """ |
| 307 | num_matched = num_neighbours_matched + num_neighbours_mismatched |
| 308 | # we don't any input |
| 309 | if num_matched == 0: |
| 310 | # start safe |
| 311 | return 0 |
| 312 | # start safely |
| 313 | safe_score = 1 if num_matched >= 10 else 0.5 |
| 314 | # calculate the ratio |
| 315 | ratio = (num_neighbours_matched / num_matched) * safe_score |
| 316 | if ratio > LOCATION_BOOST_LOW_THRESHOLD: |
| 317 | ratio = 1 |
| 318 | return LOCATION_BOOST_SCORE * ratio |
| 319 | |
| 320 | def areNeighboursSafe(): |
| 321 | """Check if the neighbour score is stable enough to be used for generating candidates. |
no outgoing calls
no test coverage detected