You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@texera.apache.org by "kz930 (via GitHub)" <gi...@apache.org> on 2026/08/12 20:41:55 UTC

[I] Gaussian Naive Bayes offers a Count Vectorizer switch that always ends the run [texera]

kz930 opened a new issue, #7597:
URL: https://github.com/apache/texera/issues/7597

   ### What happened?
   
   The two Gaussian Naive Bayes operators, `Gaussian Naive Bayes` and `Training: Gaussian Naive Bayes`, expose a `Count Vectorizer` switch that cannot succeed. Turning it on ends the execution with an error raised from inside scikit-learn: `TypeError: Sparse data was passed for X, but dense data is required. Use '.toarray()' to convert to a dense numpy array.`
   
   `CountVectorizer` emits a scipy sparse matrix, and `GaussianNB` validates its input without `accept_sparse` because it estimates a per-feature mean and variance, which reads every cell including the zeros. The refusal is deliberate on scikit-learn's side: densifying a text matrix with a large vocabulary is what would exhaust memory.
   
   This is specific to `GaussianNB`, not a property of the switch. Fitting `make_pipeline(CountVectorizer(), Estimator())` on the same documents across all 26 estimators the Sklearn and Sklearn Training groups use, only `GaussianNB` raises; the other 25, including `MultinomialNB`, `BernoulliNB` and `ComplementNB`, accept the sparse matrix. So exactly two operators carry a switch that has no working configuration.
   
   The switch is declared once on the shared base, `SklearnModelOpDesc.scala:54`, and both families splice it into the pipeline the same way (`SklearnClassifierOpDesc.scala:48`, `SklearnTrainingOpDesc.scala:47`), so every operator in both groups inherits it whether or not its estimator can use it.
   
   Expected: a combination that cannot work should not be offered. Hiding or disabling `Count Vectorizer` on these two operators would match how the family already handles an impossible pairing, since `Tfidf Transformer` and `Text Attribute` are hidden when `Count Vectorizer` is off. Failing at compile time with a message naming the estimator and pointing at the Multinomial, Bernoulli and Complement variants would also resolve it. Silently densifying would not: it reintroduces the memory cost scikit-learn refuses for a reason.
   
   <img width="988" height="931" alt="Image" src="https://github.com/user-attachments/assets/e45e20f6-6a2b-4841-bff3-6c7671c7e8b4" />
   
   ### How to reproduce?
   
   Upload a CSV with a text column and a label:
   
   ```
   note,y
   great excellent good,1
   awful terrible bad,0
   ```
   
   Build `CSV File Scan` to `Gaussian Naive Bayes`, set Target Attribute to `y`, turn on `Count Vectorizer`, set Text Attribute to `note`, and run. The execution stops and the operator console shows the TypeError. `Training: Gaussian Naive Bayes` fails the same way on the same file.
   
   ### Version/Branch
   
   1.3.0-incubating-SNAPSHOT (main)
   
   ### Relevant log output
   
   ```shell
   TypeError: Sparse data was passed for X, but dense data is required. Use '.toarray()' to convert to a dense numpy array.
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Gaussian Naive Bayes offers a Count Vectorizer switch that always ends the run [texera]

Posted by "aglinxinyuan (via GitHub)" <gi...@apache.org>.
aglinxinyuan closed issue #7597: Gaussian Naive Bayes offers a Count Vectorizer switch that always ends the run
URL: https://github.com/apache/texera/issues/7597


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Gaussian Naive Bayes offers a Count Vectorizer switch that always ends the run [texera]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #7597:
URL: https://github.com/apache/texera/issues/7597#issuecomment-5272563347

   <!-- texera:template-compliance -->
   👋 Thanks for opening this issue, @kz930!
   
   It looks like the issue description doesn't quite follow our template yet:
   
   - This issue doesn't appear to use one of our templates (Bug, Feature, or Task). Please open it using a template so the required details are captured.
   
   Filling out the template helps reviewers understand and triage your contribution faster. Please edit the description to complete it. This message will disappear automatically once the template is followed.
   
   You can find the template prompts by editing the description, or see [CONTRIBUTING.md](https://github.com/apache/texera/blob/main/CONTRIBUTING.md) for the full contribution flow.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org