Track answers recovered or lost against both rank study controls
This commit is contained in:
@@ -16,6 +16,25 @@ from functional.model import StreamingLM
|
||||
from functional.run import write_json
|
||||
|
||||
|
||||
def changed_answers(questions, comparisons, local_uniform):
|
||||
"""Identify net gains that hide different sets of corrected and lost answers."""
|
||||
ids = np.array([item['id'] for item in questions]).reshape(local_uniform.shape)
|
||||
pairwise = {}
|
||||
for name, delta in comparisons.items():
|
||||
if name != 'rank-interaction':
|
||||
pairwise[name] = {'corrected': ids[delta > 0].tolist(),
|
||||
'lost': ids[delta < 0].tolist()}
|
||||
|
||||
versus_share = comparisons['rank-vs-uniform']
|
||||
versus_allocation = comparisons['rank-vs-local']
|
||||
both = {}
|
||||
for name, sign in [('corrected_against_both', 1), ('lost_against_both', -1)]:
|
||||
mask = (versus_share == sign) & (versus_allocation == sign)
|
||||
both[name] = [{'id': item_id, 'local_uniform_correct': bool(correct)}
|
||||
for item_id, correct in zip(ids[mask].tolist(), local_uniform[mask])]
|
||||
return {'pairwise': pairwise, 'rank_combination': both}
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
for name in ('source','prior','out'):
|
||||
@@ -90,6 +109,7 @@ def main():
|
||||
sample = rng.integers(0,len(questions)//2,size=(10000,len(questions)//2))
|
||||
audit = {'questions':len(questions),
|
||||
'generation':generation,
|
||||
'changed_answers':changed_answers(questions,comparisons,scores['local-uniform']),
|
||||
'correct':{k:int(v.sum()) for k,v in scores.items()},
|
||||
'pairs_both_correct':{k:int(v.all(1).sum()) for k,v in scores.items()},
|
||||
'paired_differences':{k:{'delta':float(v.mean()),
|
||||
|
||||
Reference in New Issue
Block a user