MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / ranks

Function ranks

experiments/analysis/analyze_human_score_correlation.py:40–52  ·  view source on GitHub ↗
(values: List[float])

Source from the content-addressed store, hash-verified

38
39
40def ranks(values: List[float]) -> List[float]:
41 indexed = sorted(enumerate(values), key=lambda item: item[1])
42 result = [0.0] * len(values)
43 i = 0
44 while i < len(indexed):
45 j = i
46 while j + 1 < len(indexed) and indexed[j + 1][1] == indexed[i][1]:
47 j += 1
48 rank = (i + j + 2) / 2.0
49 for k in range(i, j + 1):
50 result[indexed[k][0]] = rank
51 i = j + 1
52 return result
53
54
55def spearman(pairs: List[Tuple[float, float]]) -> float:

Callers 1

spearmanFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected