INNER CODE UNIT · Python
tot
linzhiqiu/t2v_metrics · dataset.py:130
tot = con + dis + xtie_only + ytie_only + tie_both
if variant in ['b', 'c'] and (xtie == tot or ytie == tot):
return np.nan, 0
if variant == 'b':
tau = (con - dis) / np.sqrt(tot - xtie) / np.sqrt(tot - ytie)
elif variant == 'c':
minclasses = min(len(set(x)), len(set(y)))
tau = 2 * (con - dis) / (size**2 * (minclasses - 1) / minclasses)
elif variant == '23':
tau = (con + tie_both - dis - xtie_only - ytie_only) / tot
elif variant == 'acc23':
tau = (con + tie_both) / tot
else:
raise ValueError(
f'Unknown variant of the method chosen: {variant}. '
"variant must be 'b', 'c', '23', or 'acc23'.")