INNER CODE UNIT · Python
t_y
linzhiqiu/t2v_metrics · dataset.py:63
t_y = int((~x_is_tie & y_is_tie).sum() / 2)
t_xy = int(((x_is_tie & y_is_tie).sum() - n) / 2) # -n removes diagonal
dis = num_pairs - (con + t_x + t_y + t_xy)
return con, dis, t_x, t_y, t_xy
def KendallVariants(
gold_scores,
metric_scores,
variant: str = 'acc23',
epsilon: float = 0.0,
) -> Tuple[float, float]:
"""Lightweight, optionally factored versions of variants on Kendall's Tau.
This function calculates the sufficient statistics for tau in two different
ways, either using a Fenwick Tree (`_FenwickTreeSufficientStatistics`) when
`epsilon` is 0 or NumPy matrices (`_MatrixSufficientStatistics`) otherwise.
Note that the latter implementation has an O(n^2) space requirement, which