Skip to content

Fix the non-smoothed online p-value: wrong index and an unassigned name - #53

Open
shivamlalakiya wants to merge 1 commit into
henrikbostrom:mainfrom
shivamlalakiya:fix-online-nonsmoothed-p-values
Open

Fix the non-smoothed online p-value: wrong index and an unassigned name#53
shivamlalakiya wants to merge 1 commit into
henrikbostrom:mainfrom
shivamlalakiya:fix-online-nonsmoothed-p-values

Conversation

@shivamlalakiya

Copy link
Copy Markdown

Fixes #52.

Two independent one-line fixes in p_values_online_classification's smoothing=False
arms; grouped in one PR because they're two lines of the same function, not because they're
related (either could be reverted independently of the other).

1. base.py:3055: all_alphas[q] (calibration element q) becomes
all_alphas[start+q] (the test point), matching every sibling branch in the function
(:3042, :3044, :3050). No +1 added to the numerator: all_alphas[start+q] is the
last element of the [:start+q+1] window and already counts itself.

2. base.py:3093 and :3100: p_values_bin becomes bin_p_values, matching the name
:3107 reads and the five other accumulate blocks in the file that already use it
(:2943, :2963, :3086, :3297, :3309). Both branches raised UnboundLocalError
unconditionally before this fix.

Verified both directions with the reproductions in #52: the first fix flips the
monotonicity-sweep table from inverted to correct, and the second turns the
UnboundLocalError into a normal return across predict_p_online, predict_set_online,
and evaluate(online=True), both all_classes settings. No existing output can change for
fix 2, since that branch raised 100% of the time before it.

p_values_online_classification's smoothing=False arms have two independent
bugs, both in the code added for online (Mondrian) p-values:

- base.py:3055 indexed all_alphas[q] (a calibration score) instead of
  all_alphas[start+q] (the test score), so the non-Mondrian path returned
  the rank of the wrong object. The p-value moved in the wrong direction
  as the test label became less conforming.
- base.py:3093 and :3100 assigned p_values_bin, but :3107 reads
  bin_p_values, which every other accumulate block in the file uses.
  Both Mondrian smoothing=False branches raised UnboundLocalError
  unconditionally through predict_p_online, predict_set_online, and
  evaluate(online=True).

Fixes henrikbostrom#52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

predict_p_online, smoothing=False: p-value ranks the wrong object, and the Mondrian path crashes

1 participant