MCPcopy Create free account
hub / github.com/CheckPointSW/Karta / getNeighbourScore

Function getNeighbourScore

src/config/utils.py:301–318  ·  view source on GitHub ↗

Return the current (scaled) score boost for neighbours. Return Value: Scaled neighbour score boost

()

Source from the content-addressed store, hash-verified

299 num_neighbours_mismatched = 0
300
301def 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
320def areNeighboursSafe():
321 """Check if the neighbour score is stable enough to be used for generating candidates.

Callers 4

matchAttemptMethod · 0.85
attemptMatchesMethod · 0.85
attemptMatchSwallowMethod · 0.85
areNeighboursSafeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected