Compare holdout gains directly to the verified original LiSA baseline
This commit is contained in:
@@ -7,7 +7,7 @@ from pathlib import Path
|
||||
import numpy as np
|
||||
import torch
|
||||
|
||||
from crossqkv.lisa_combination_eval import changed_answers
|
||||
from crossqkv.lisa_combination_eval import changed_answers, score_differences
|
||||
from crossqkv.lisa_combination_screen import SITES, paired_questions
|
||||
from crossqkv.lisa_rank_compare import assignments, make_adapters, score_gold_answers
|
||||
from crossqkv.lisa_trajectory_train import replay_teacher_inputs, reverse_kl
|
||||
@@ -36,6 +36,22 @@ class CombinationTests(unittest.TestCase):
|
||||
with self.assertRaises(ValueError):
|
||||
replay_teacher_inputs(native_tail, path, wrong_ids, start, lengths)
|
||||
|
||||
def test_combinations_compare_to_the_original_and_matched_controls(self):
|
||||
scores = {
|
||||
'prior-lisa': np.array([[0, 1]]), 'shared-uniform': np.array([[1, 0]]),
|
||||
'shared-allocated': np.array([[1, 1]]), 'shared-reversed': np.array([[0, 0]]),
|
||||
'local-allocated': np.array([[1, 0]]), 'local-uniform': np.array([[0, 0]]),
|
||||
'trajectory-student': np.array([[1, 0]]), 'trajectory-reference': np.array([[0, 0]]),
|
||||
}
|
||||
differences = score_differences(scores)
|
||||
for name, expected in {
|
||||
'rank-vs-prior': [[1, 0]], 'rank-vs-uniform': [[0, 1]],
|
||||
'rank-vs-reversed': [[1, 1]], 'rank-vs-local': [[0, 1]],
|
||||
'rank-interaction': [[-1, 1]], 'student-vs-prior': [[1, -1]],
|
||||
'reference-vs-prior': [[0, -1]], 'student-vs-reference': [[1, 0]],
|
||||
}.items():
|
||||
np.testing.assert_array_equal(differences[name], expected, err_msg=name)
|
||||
|
||||
def test_joint_recoveries_require_beating_both_single_methods_on_one_item(self):
|
||||
items = [{'id': name} for name in ['a', 'b', 'c', 'd']]
|
||||
diffs = {'rank-vs-uniform': np.array([[1, -1], [1, 0]]),
|
||||
|
||||
Reference in New Issue
Block a user