Skip to content

fix: handle null-only text column in TextTransformer.transform (#801)#834

Open
kartikjsonawane wants to merge 1 commit into
mljar:masterfrom
kartikjsonawane:fix/text-transformer-empty-array-perform-mode
Open

fix: handle null-only text column in TextTransformer.transform (#801)#834
kartikjsonawane wants to merge 1 commit into
mljar:masterfrom
kartikjsonawane:fix/text-transformer-empty-array-perform-mode

Conversation

@kartikjsonawane

Copy link
Copy Markdown

Fixes #801
In Perform mode, _base_predict is called with a single sample (X.iloc[:1]) to measure prediction time. If that sample's text column is null, filtering out nulls produces an empty array — causing TfidfVectorizer.transform() to crash with "Found array with 0 sample(s)". Explain mode is unaffected because _max_single_prediction_time is None there, so _base_predict is never called.
Fix (supervised/preprocessing/text_transformer.py): initialize output columns to 0.0 first, then only call the vectorizer when there are non-null rows. Null-only inputs get zero-filled columns, which is the correct default.

…#801)

In Perform mode, _base_predict is called with a single sample to measure
prediction time. If that sample has a null text column, filtering out
nulls produces an empty array, causing TfidfVectorizer to crash with
'Found array with 0 sample(s)'.

Fix: initialize output columns to 0.0 first, then only call the
vectorizer when there are non-null rows to transform.
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.

Preprocessing fails in Perform mode

1 participant