INNER CODE UNIT · Python

y_diffs

linzhiqiu/t2v_metrics · dataset.py:51

    y_diffs = y1 - y2
    y_is_tie = y_diffs == 0.0

    n = len(y)
    num_pairs = int(scipy.special.comb(n, 2))
    # All of the counts are divided by 2 because each pair is double counted. The
    # double counted data will always be an even number, so dividing by 2 will
    # be an integer.
    con = int(
        ((x_diffs > 0) & (y_diffs > 0) | (x_diffs < 0) & (y_diffs < 0)).sum() / 2
    )
    t_x = int((x_is_tie & ~y_is_tie).sum() / 2)
    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

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…