Skip to content

fix(oddshap): address all six Copilot review comments on PR #522#5

Merged
42logos merged 2 commits into
oddshap_approximatorfrom
wu/oddshap-review-fixes
Jun 10, 2026
Merged

fix(oddshap): address all six Copilot review comments on PR #522#5
42logos merged 2 commits into
oddshap_approximatorfrom
wu/oddshap-review-fixes

Conversation

@42logos

@42logos 42logos commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Resolves every inline comment from the Copilot review on mmschlk#522 (2026-06-10):

  1. Fail fast on invalid budget — the budget < n*interaction_factor check now runs before _sampler.sample() / game(), so callers no longer pay for game evaluations before the ValueError.
  2. Full-budget support is no longer truncated — at budget >= 2**n the candidate odd support bypasses the ceil(budget/eta) top-k cap (the regression is exact there).
  3. No hard-coded indexInteractionValues(index=self.approximation_index, ..., target_index=self.index).
  4. Test-module docstring rewritten — it still described the removed TreeExplainer fallback branch and a non-existent xfail marker.
  5. skip_if_no_lightgbm added as module-level pytestmark, matching the ProxySPEX test suite (lightgbm is under the optional proxy extra).
  6. references.bib entry reindented with the file's 2-space style (was tabs).

59/59 OddSHAP unit tests pass; ruff clean.

42logos added 2 commits June 10, 2026 10:55
- Validate the budget before sampling/evaluating the game so an invalid
  budget fails fast without paying for game evaluations.
- Restore the full-budget semantics: when the sampler enumerates all 2**n
  coalitions, the candidate odd support is no longer truncated to
  ceil(budget/eta).
- InteractionValues now carries index=self.approximation_index and
  target_index=self.index instead of hard-coded strings.
- Rewrite the stale test-module docstring (it still described the removed
  low-budget TreeExplainer fallback and a non-existent xfail marker).
- Mark the OddSHAP test module skip_if_no_lightgbm, matching the other
  LightGBM-dependent suites (lightgbm is an optional extra).
- Reindent the new references.bib entry with spaces (2-space style of the
  surrounding entries) instead of tabs.
…test

- Mark the five defensive, structurally unreachable raises with
  'pragma: no cover' (empty/grand coalition presence, unbuilt support,
  empty constraint system, coefficient-shape mismatch), following the
  existing convention in approximator/base.py and regression/base.py.
- Add real tests for the previously uncovered reachable branches:
  degenerate-n weight initializers (ValueError), the tree_params branch of
  _fit_surrogate_model, _build_support(None), and
  _build_weighted_system(drop_boundary_rows=False).
- Replace the vacuous full-budget screening test (it asserted nothing about
  truncation) with an end-to-end check that approximate() passes the
  untruncated candidate count at budget=2**n, plus a direct check that a
  large candidate budget returns the full odd support.
- references.bib: align the '=' column of the new entry with the file's
  longest-key+1 convention (was only tab->space converted).
@42logos 42logos merged commit f8bc76b into oddshap_approximator Jun 10, 2026
11 of 12 checks passed
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.

1 participant