Repository navigation
fix(classifier): honour PASSTHROUGH_INF in predict_proba_batched - #1351
Open
aniruddhaadak80 wants to merge 3 commits into
Open
aniruddhaadak80 wants to merge 3 commits into
aniruddhaadak80 wants to merge 3 commits into
Conversation
The batched prediction path called clean_data_transform without the
passthrough_inf kwarg, so the argument fell back to its False default even
when the user set inference_config={"PASSTHROUGH_INF": True}. The standard
path (_raw_predict) forwards the same setting, so the two predict paths
disagreed for that one user configuration.
The divergence is only visible on categorical columns: a numeric column
carrying a +/-inf passes through the ordinal encoder's remainder untouched,
which is why the comment in clean_data_transform calls the flag a no-op
when the encoder selects nothing. On a categorical column the infinity is a
category value the encoder never saw at fit, so with the flag dropped it was
encoded as the unknown-category code -1.0 -- a finite value the model reads
as a legitimate category level, with the infinity silently gone.
Forward worker.get_inference_config().PASSTHROUGH_INF, matching the standard
path. worker is a clone(self) that has already been fitted at that point, so
inference_config_ is set and the accessor is a plain deepcopy.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 621219b. Configure here.
Contributor
Author
|
Thanks. Fixed in ad4910a. changelog/1351.fixed.md is now a single user-facing line - it honours PASSTHROUGH_INF in predict_proba_batched, matching the standard prediction path - without naming the internal helper or the encoded sentinel value. |
This branch has not been deployed
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.

Issue
Fixes #1346
Motivation and Context
predict_proba_batched calls clean_data_transform without passthrough_inf, so an explicit inference_config={"PASSTHROUGH_INF": True} is silently ignored on that path.
Batched path (classifier.py ~1260):
python X_test = clean_data_transform( X_test, cat_indices=worker.inferred_feature_schema_.indices_for(FeatureModality.CATEGORICAL), ord_encoder=getattr(worker, "ordinal_encoder_", None), )Standard path (classifier.py ~1615) is identical except that it also passes passthrough_inf=self.get_inference_config().PASSTHROUGH_INF.
The two paths are documented to validate and clean input identically, and the code comment above the batched call says as much, so a user cannot tell that one of them honours this setting.
The consequence is worse than losing the value. get_ordinal_encoder is configured with handle_unknown="use_encoded_value", unknown_value=-1, encoded_missing_value=np.nan, so an inf in a column the encoder selects becomes the finite code -1.0 - not a missing value, but an ordinary ordinal level the model reads as real. Measured at the two call sites:
--- CATEGORICAL column: +inf at row 1, column 1 --- input : inf standard (flag=True) : np.float64(inf) batched (flag=False) : np.float64(-1.0) paths agree : FalseThe bug is confined to columns the ordinal encoder selects; a numeric column already agreed, because it passes through the remainder untouched.
The fix forwards worker.get_inference_config().PASSTHROUGH_INF. worker is clone(self) and has already been fitted at that point, so this is the same call the standard path makes on self.
Public API Changes
No signature changes. predict_proba_batched now honours PASSTHROUGH_INF as documented.
How Has This Been Tested?
Three tests added to ests/test_preprocessing/test_inf_handling.py, running the real predict_proba_batched with a randomly-initialised abpfn_v3 so no checkpoint download is needed:
With the one line removed, the first two fail (�ssert False is True, and an array mismatch); with the fix all three pass:
$ python -m pytest tests/test_preprocessing/test_inf_handling.py -k predict_proba_batched -q 3 passed, 52 deselected in 12.20sSix further files exercising this path were run before and after the change with byte-identical results (28 failed / 137 passed / 25 skipped in both), and every one of those failures is a TabPFNLicenseError or a gated-repo error from having no TABPFN_TOKEN on this machine - so the change introduces no regression.
uff check and
uff format --check are clean.
Not verified here: end-to-end prediction with trained weights, since no checkpoint is available locally. The divergence is demonstrated at the preprocessing call site that is the subject of the fix.
Checklist