Skip to content

Fix multiclass LinearSVC fallback paths (closes #256)#345

Merged
oegedijk merged 1 commit intomasterfrom
fix-256-linearsvc-multiclass-fallback
Feb 8, 2026
Merged

Fix multiclass LinearSVC fallback paths (closes #256)#345
oegedijk merged 1 commit intomasterfrom
fix-256-linearsvc-multiclass-fallback

Conversation

@oegedijk
Copy link
Copy Markdown
Owner

@oegedijk oegedijk commented Feb 8, 2026

Problem

Issue #256 reports multiclass LinearSVC failing in dashboard/explainer flows because it typically exposes decision_function but not predict_proba. Existing code paths assumed predict_proba, which caused:

  • hard failures in PDP/permutation paths (AttributeError)
  • class-count mismatches in SHAP flows when patched probabilities were malformed

What Changed

  • Added a shared probability fallback that:
    • uses predict_proba when valid
    • falls back to decision_function and converts scores to probabilities (sigmoid for binary, softmax for multiclass)
  • Applied fallback consistently across:
    • ClassifierExplainer prediction and kernel-SHAP callback paths
    • PDP generation (get_pdp_df)
    • one-vs-all and safe scorer paths used by permutation importances
  • Added validation for class-count/shape mismatches to prevent silent bad outputs.

Tests

Added regression tests for multiclass LinearSVC:

  • kernel SHAP path
  • PDP path
  • permutation importances path

Added guard tests for multiclass logistic regression to ensure existing predict_proba behavior remains unchanged.

Release Notes

Updated RELEASE_NOTES.md under 0.5.8 with issue #256 fixes and coverage.

Validation Run

  • uv run pytest -q tests/test_linear_model.py
  • uv run ruff check explainerdashboard/explainer_methods.py explainerdashboard/explainers.py tests/test_linear_model.py

Closes #256

@oegedijk oegedijk merged commit 451357f into master Feb 8, 2026
13 checks passed
@oegedijk oegedijk deleted the fix-256-linearsvc-multiclass-fallback branch February 8, 2026 14:05
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.

Linear SVC model on multiclass classification

1 participant