refactor(transparency): resolve method families via own algorithm_registry; drop framework hardcoding#355
Merged
Conversation
172a3e5 to
9cc2a6a
Compare
Collaborator
Author
|
Folded in two de-hardcode follow-ups surfaced by a parallel dead-code audit (same #318 smell family), commit
Both verified locally (test_diagnostics 16, test_ci 6 green). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Removes bootstrap-era hardcoded
ShapExplainer/CaptumExplainerknowledge from the framework-agnostic transparency layer (issue #318), so third-party plugin adapters are handled correctly instead of silently mishandled.Investigation showed the fix is a pure simplification, not a new abstraction: every real explainer — in-tree or plugin — is a decorated adapter carrying its own
algorithm_registryClassVar (mandated by@adapters.transparency), so it always resolves via the own-registry lookup. Theframework-label path and the cross-framework algorithm-string scan were dead in production (only test stubs reached them), and the factory's"shap"/"captum"name-sniffing gate actively skipped the visualiser semantic-compat check for plugins named neither.Changes:
transparency/semantics.py:method_families_for_explainer/_hints_for_explainernow resolve solely viatype(explainer).algorithm_registry(same shape asrobustness/semantics.py). Deleted the dead helpers_adapter_class_for_framework,_explainer_framework,_normalise_framework,_method_families_for_algorithm, and the unusedAbstractSetimport.transparency/factory.py: deleted_requires_registry_semantics(the name-sniff gate) and the two hardcoded explainer imports;check_explainer_visualiser_semantic_compatnow always runs and dropped its unusedexplainer_targetparam.algorithm_registry; deleted tests that only exercised the removed fallback paths.Net: 25 insertions / 225 deletions. No behavior change for shap/captum; the only intended behavior change is that the visualiser semantic-compat check now also runs for adapters named neither (i.e. future plugins).
API note (reviewers): removed the
algorithm=keyword param from the publicinfer_output_spaceand theexplainer_targetparam fromcheck_explainer_visualiser_semantic_compat. Both were dead — no in-tree production caller passed them (only tests did). Pre-1.0, treated as a clean removal, not a breaking change.Closes #318.
Checklist
infer_output_space(algorithm=...),check_explainer_visualiser_semantic_compat(explainer_target=...)) had no production callers. No!in the title.Optional