srowen commented on a change in pull request #28621:
URL: https://github.com/apache/spark/pull/28621#discussion_r429550810



##########
File path: mllib/src/main/scala/org/apache/spark/ml/Predictor.scala
##########
@@ -79,6 +79,7 @@ private[ml] trait PredictorParams extends Params
 
     dataset.select(col($(labelCol)).cast(DoubleType), w, 
col($(featuresCol))).rdd.map {
       case Row(label: Double, weight: Double, features: Vector) =>
+        require (weight >= 0.0, "illegal weight value: " + weight + " weight 
must be >= 0.0")

Review comment:
       I was going to wonder if we should require weights to be positive, but I 
don't think we do now. I guess we tend to catch it when we check whether all 
weights are 0 (sum = 0).
   BTW you can use string interpolation in these error messages.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to