Skip to content

Require explicit EBM callback mappings - #695

Open
paulbkoch wants to merge 3 commits into
mainfrom
paulbkoch-ebm-callback-detection
Open

paulbkoch wants to merge 3 commits into
mainfrom
paulbkoch-ebm-callback-detection

Conversation

@paulbkoch

Copy link
Copy Markdown
Collaborator

Summary

Replace callback signature autodetection with an explicit event-to-callable mapping:

callbacks={"boost": report_metric}
  • Accept mappings with "examine", "boost", and "interaction" keys; validate names and callable values. None and empty mappings disable callbacks.
  • Remove parameter-name inference and support for bare callables or sequences, with no compatibility fallback.
  • Preserve callback timing, keyword arguments, and return actions while allowing generic **kwargs handlers, forwarding wrappers, partials (including update_wrapper), mocks, built-ins, and a shared handler registered for multiple events.

Documentation

  • Update the callback contract in all three estimator docstrings and add usage examples, event arguments, stop actions, and parallel-state guidance to the hyperparameter guide.
  • Render the canonical estimator classes on the existing API pages so their parameter documentation is visible, while preserving the alias links and page URLs.
  • Update the benchmark timer example to the explicit mapping and current return-action contract.

Validation

  • Final callback suite: 59 passed, including direct EBMModel, classifier, and regressor coverage. The related short/long callback and merge-callback cases also passed.
  • Built the Windows x64 release native library and verified that Python loaded the workspace artifact.
  • Targeted mypy and touched-file Ruff formatting checks passed. Ruff lint reports no new diagnostics; the existing findings decreased from 197 to 166.
  • Checked modified notebook JSON, exercised the benchmark timer callback, and verified the rendered callback documentation and preserved API anchors.
  • Full documentation rendering with notebook execution disabled completes, but --warningiserror exits nonzero on 10 code-highlighting warnings in unchanged example notebooks. No warnings were emitted for the updated callback documentation.

paulbkoch and others added 2 commits October 17, 2026 23:49
Replace signature inference with event-to-callable mappings and update callback documentation, examples, and regression coverage.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: cddaf74d-b4ad-4361-8299-f2f779330d5a
@codecov

codecov Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.29%. Comparing base (d82ea62) to head (6a28f0c).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #695      +/-   ##
==========================================
- Coverage   67.32%   67.29%   -0.03%     
==========================================
  Files          77       77              
  Lines       11739    11707      -32     
==========================================
- Hits         7903     7878      -25     
+ Misses       3836     3829       -7     
Flag Coverage Δ
bdist_linux_311_python 67.04% <100.00%> (-0.02%) ⬇️
bdist_linux_312_python 67.04% <100.00%> (-0.02%) ⬇️
bdist_linux_313_python 67.01% <100.00%> (-0.05%) ⬇️
bdist_linux_314_python 66.95% <100.00%> (-0.02%) ⬇️
bdist_linuxarm_311_python 67.06% <100.00%> (-0.02%) ⬇️
bdist_linuxarm_312_python 67.04% <100.00%> (-0.02%) ⬇️
bdist_linuxarm_313_python 67.06% <100.00%> (+<0.01%) ⬆️
bdist_linuxarm_314_python 66.95% <100.00%> (-0.04%) ⬇️
bdist_mac_311_python 67.20% <100.00%> (-0.02%) ⬇️
bdist_mac_312_python 67.20% <100.00%> (+<0.01%) ⬆️
bdist_mac_313_python 67.20% <100.00%> (-0.02%) ⬇️
bdist_mac_314_python 67.11% <100.00%> (-0.02%) ⬇️
bdist_win_311_python 67.20% <100.00%> (-0.05%) ⬇️
bdist_win_312_python 67.22% <100.00%> (-0.02%) ⬇️
bdist_win_313_python 67.20% <100.00%> (-0.03%) ⬇️
bdist_win_314_python 67.13% <100.00%> (-0.02%) ⬇️
sdist_linux_311_python 66.97% <100.00%> (-0.03%) ⬇️
sdist_linux_312_python 66.97% <100.00%> (-0.02%) ⬇️
sdist_linux_313_python 66.99% <100.00%> (+<0.01%) ⬆️
sdist_linux_314_python 66.88% <100.00%> (-0.04%) ⬇️
sdist_linuxarm_311_python 66.98% <100.00%> (-0.02%) ⬇️
sdist_linuxarm_312_python 66.98% <100.00%> (-0.04%) ⬇️
sdist_linuxarm_313_python 67.00% <100.00%> (+<0.01%) ⬆️
sdist_linuxarm_314_python 66.90% <100.00%> (-0.02%) ⬇️
sdist_mac_311_python 67.09% <100.00%> (-0.04%) ⬇️
sdist_mac_312_python 67.10% <100.00%> (-0.04%) ⬇️
sdist_mac_313_python 67.10% <100.00%> (-0.04%) ⬇️
sdist_mac_314_python 66.99% <100.00%> (-0.05%) ⬇️
sdist_win_311_python 67.19% <100.00%> (-0.03%) ⬇️
sdist_win_312_python 67.22% <100.00%> (-0.02%) ⬇️
sdist_win_313_python 67.22% <100.00%> (-0.02%) ⬇️
sdist_win_314_python 67.11% <100.00%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused API change has consistent validation, migrated callers, and regression coverage, with no unresolved findings.

No open issues 🎉

What changed in this PR

Replaces EBM callback signature inference with explicit event-to-callable mappings, updating tests and documentation for the new contract.

Changes:

  • Validates event names and callable values without inspecting signatures.
  • Migrates callback tests and adds coverage for flexible handlers.
  • Documents callback registration, return actions, and parallel-state behavior.
File Description
python/​interpret-core/​tests/​glassbox/​ebm/​test_merge_ebms.py Migrates merge callback test to mapping syntax.
python/​interpret-core/​tests/​glassbox/​ebm/​test_ebm.py Updates timer callback registration.
python/​interpret-core/​tests/​glassbox/​ebm/​test_callback.py Expands mapping validation and handler coverage.
python/​interpret-core/​interpret/​glassbox/​_ebm.py Implements explicit mappings and updates estimator docstrings.
python/​interpret-core/​interpret/​glassbox/​_ebm_core/​_merge_ebms.py Clarifies callback cleanup comments only.
docs/​interpret/​python/​api/​ExplainableBoostingRegressor.ipynb Renders canonical regressor documentation alongside the alias.
docs/​interpret/​python/​api/​ExplainableBoostingClassifier.ipynb Renders canonical classifier documentation alongside the alias.
docs/​interpret/​hyperparameters.md Adds callback usage and behavior guidance.
docs/​benchmarks/​ebm-benchmark.ipynb Updates timer handler and commented registration example.

Review effort: Balanced

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants