INNER CODE UNIT · Python
tau
linzhiqiu/t2v_metrics · dataset.py:141
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'.")
return tau, 0
def calc_metric(gold_scores, metric_scores, variant: str="pairwise_acc_with_tie_optimization", sample_rate=1.0):
gold_scores = np.array(gold_scores)
metric_scores = np.array(metric_scores)
assert gold_scores.shape == metric_scores.shape
if gold_scores.ndim == 1:
# No grouping
gold_scores = gold_scores.reshape(1, -1)
metric_scores = metric_scores.reshape(1, -1)