Github user srowen commented on a diff in the pull request:
https://github.com/apache/spark/pull/11852#discussion_r57121425
--- Diff:
mllib/src/main/scala/org/apache/spark/mllib/classification/NaiveBayes.scala ---
@@ -326,6 +326,8 @@ class NaiveBayes private (
/** Set the smoothing parameter. Default: 1.0. */
@Since("0.9.0")
def setLambda(lambda: Double): NaiveBayes = {
+ require(lambda > 0,
+ s"Smoothing parameter must be greater than 0 but got ${lambda}")
--- End diff --
Yeah this is looking good, to get all of the same obvious parameter checks
done in one pass. You can say "positive" for "greater than 0" and "nonnegative"
for "greater than or equal to 0" but this is fine.
---
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]