Github user jkbradley commented on a diff in the pull request:
https://github.com/apache/spark/pull/6073#discussion_r30156892
--- Diff:
mllib/src/main/scala/org/apache/spark/mllib/classification/NaiveBayes.scala ---
@@ -291,6 +294,9 @@ class NaiveBayes private (
if (!values.forall(_ >= 0.0)) {
throw new SparkException(s"Naive Bayes requires nonnegative
feature values but found $v.")
}
+ if (modelType == "Bernoulli" && (!values.forall(v => v == 0.0 || v
== 1.0) )) {
--- End diff --
This should be in a function separate from ```requireNonnegativeValues```
since it should be used in ```createCombiner``` but not ```mergeValue``` in the
aggregation below. I bet the test case with valid input would catch this issue
if it had more rows with non-zeros.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]