Track answers recovered or lost against both rank study controls
This commit is contained in:
@@ -4,14 +4,29 @@ import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
import numpy as np
|
||||
import torch
|
||||
|
||||
from crossqkv.lisa_combination_eval import changed_answers
|
||||
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 reverse_kl
|
||||
|
||||
|
||||
class CombinationTests(unittest.TestCase):
|
||||
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]]),
|
||||
'rank-vs-local': np.array([[1, -1], [0, 0]]),
|
||||
'rank-interaction': np.array([[2, -2], [0, 0]])}
|
||||
result = changed_answers(items, diffs, np.array([[0, 1], [0, 1]]))
|
||||
self.assertEqual(result['pairwise']['rank-vs-uniform'],
|
||||
{'corrected': ['a', 'c'], 'lost': ['b']})
|
||||
self.assertNotIn('rank-interaction', result['pairwise'])
|
||||
self.assertEqual(result['rank_combination'], {
|
||||
'corrected_against_both': [{'id': 'a', 'local_uniform_correct': False}],
|
||||
'lost_against_both': [{'id': 'b', 'local_uniform_correct': True}]})
|
||||
|
||||
def test_reverse_kl_gradient_matches_dense_unequal_vocab_chunks(self):
|
||||
rng = torch.Generator().manual_seed(72504)
|
||||
def normal(*shape):
|
||||
|
||||
Reference in New Issue
Block a user