Repository navigation
fix(predict): classification labels are strings whatever return_proba is (#45) - #56
Merged
Merged
Conversation
Member
Author
|
Review fixes pushed. The independent review found no bugs: tabicl 2.1.1's and tabpfn 8.5.0's
Unit tests: 501 pass. |
… is (#45) TabICL returned predict()'s labels without probabilities (numbers for a JSON train_y) and strings from classes with them; TabPFN always returned strings. Both now go through backends.base.classification_outcome: one predict_proba pass, argmax over the class strings, probabilities and classes only when asked. The predictions field documents the contract. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…igned - classification_outcome moves to backends/_outcome.py, keeping base.py protocol-only; proba typed ArrayLike. - The fake backend reports through it too, so its label is the argmax of its own probabilities (ties went to the first label seen). - The real-model kv test checks return_proba=False gives the same labels. - API doc and CHANGELOG wording. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
amrit110
force-pushed
the
fix/label-types
branch
from
October 20, 2026 21:20
d966702 to
26e28a3
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #56 +/- ##
==========================================
+ Coverage 79.43% 79.45% +0.02%
==========================================
Files 41 42 +1
Lines 3209 3218 +9
==========================================
+ Hits 2549 2557 +8
- Misses 660 661 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Open
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.
Closes #45.
Problem
A classification's
predictionschanged type withreturn_proba:return_proba: truereturn_proba: falsetabicl-v2(before)["1.0"][1.0]tabpfn-3.5["1.0"]["1.0"]Without probabilities,
TabICLBackend._predictreturnedmodel.predict(X).tolist(). That keeps the label dtype, and it goes against the backend protocol, which says to derive labels from probabilities.Fix
backends.base.classification_outcome(proba, classes, return_proba): argmax over[str(c) for c in classes], with probabilities and classes only when asked. TabICL and TabPFN both use it, so the two backends can't drift apart again, and TabICL no longer callspredict().predictionsfield documents the contract. Classification gives strings whateverreturn_probais; regression gives numbers.tabicl-v2clients that relied on numeric labels withoutreturn_probanow get strings, as withtabpfn-3.5. This is noted in the CHANGELOG.Tests
tests/unit/test_classification_outcome.py:_predict, driven by a stub estimator whosepredict()raises. The TabICL case fails on main's code (checked).Not in this PR
"1.0"for a JSON1comes fromtrain_ybeing parsed as floats. Whether to keep integer labels as integers is the separate question noted in TabICL classification predict returns numeric labels without return_proba, strings with it #45.No architecture change.
🤖 Generated with Claude Code