Prioritize investigation hypotheses by confidence after bootstrap
This commit is contained in:
1 parent
f4082585ae
commit
c44ccd5ce3
5 files changed
+128
-2
No files matched your search
@@ -0,0 +1,39 @@
|
||||
import copy
|
||||
|
||||
from viano_bug_analysis.analysis.investigation_scheduler import priority_order
|
||||
|
||||
|
||||
def hypothesis(confidence='unassessed',iterations=1):
|
||||
return {'confidence':confidence,'iterations':iterations}
|
||||
|
||||
|
||||
def order(hypotheses):
|
||||
return [hid for _,hid in priority_order(hypotheses)]
|
||||
|
||||
|
||||
def test_bootstrap_turns_precede_already_strong_hypotheses():
|
||||
states={'H1':hypothesis('strongly_supported'),'H2':hypothesis(iterations=0),'H3':hypothesis(iterations=0)}
|
||||
assert order(states)==['H2','H3','H1']
|
||||
states['H2']['iterations']=1
|
||||
assert order(states)==['H3','H1','H2']
|
||||
|
||||
|
||||
def test_confidence_rises_and_falls_without_changing_budget_or_state():
|
||||
states={'H1':hypothesis('plausible'),'H2':hypothesis('supported'),'H3':hypothesis('weak')}
|
||||
before=copy.deepcopy(states)
|
||||
assert order(states)==['H2','H1','H3']
|
||||
assert states==before
|
||||
states['H2']['confidence']='weakened'
|
||||
assert order(states)==['H1','H3','H2']
|
||||
states['H3']['confidence']='strongly_supported'
|
||||
assert order(states)==['H3','H1','H2']
|
||||
|
||||
|
||||
def test_equal_confidence_uses_numeric_hypothesis_id_not_rotation_or_string_sort():
|
||||
states={hid:hypothesis('supported') for hid in ['H10','H5','H3','H2','H1']}
|
||||
assert order(states)==['H1','H2','H3','H5','H10']
|
||||
assert dict(priority_order(states))[0]=='H1'
|
||||
|
||||
|
||||
def test_unassessed_alternative_is_preferred_over_weakened_candidate():
|
||||
assert order({'H1':hypothesis('weak'),'H2':hypothesis(),'H3':hypothesis('weakened')})==['H2','H1','H3']
|
||||
Reference in new issue
Block a user