[ https://issues.apache.org/jira/browse/SPARK-14183?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15216206#comment-15216206 ]
Yong Tang commented on SPARK-14183: ----------------------------------- With the latest master build the message changes to: {code} scala> val model = cv.fit(df) 16/03/29 15:47:29 WARN LogisticRegression: All labels are zero and fitIntercept=true, so the coefficients will be zeros and the intercept will be negative infinity; as a result, training is not needed. java.lang.IllegalArgumentException: requirement failed: Nothing has been added to this summarizer. at scala.Predef$.require(Predef.scala:219) at org.apache.spark.mllib.stat.MultivariateOnlineSummarizer.normL2(MultivariateOnlineSummarizer.scala:270) at org.apache.spark.mllib.evaluation.RegressionMetrics.SSerr$lzycompute(RegressionMetrics.scala:65) at org.apache.spark.mllib.evaluation.RegressionMetrics.SSerr(RegressionMetrics.scala:65) at org.apache.spark.mllib.evaluation.RegressionMetrics.meanSquaredError(RegressionMetrics.scala:99) at org.apache.spark.mllib.evaluation.RegressionMetrics.rootMeanSquaredError(RegressionMetrics.scala:108) at org.apache.spark.ml.evaluation.RegressionEvaluator.evaluate(RegressionEvaluator.scala:94) at org.apache.spark.ml.tuning.CrossValidator$$anonfun$fit$1.apply(CrossValidator.scala:110) at org.apache.spark.ml.tuning.CrossValidator$$anonfun$fit$1.apply(CrossValidator.scala:100) at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33) at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:186) at org.apache.spark.ml.tuning.CrossValidator.fit(CrossValidator.scala:100) ... 55 elided {code} That looks much better than {noformat}UnsupportedOperationException: empty.max{noformat} > UnsupportedOperationException: empty.max when fitting CrossValidator model > --------------------------------------------------------------------------- > > Key: SPARK-14183 > URL: https://issues.apache.org/jira/browse/SPARK-14183 > Project: Spark > Issue Type: Improvement > Components: ML > Affects Versions: 2.0.0 > Reporter: Jacek Laskowski > Priority: Minor > > The following code produces {{java.lang.UnsupportedOperationException: > empty.max}}, but it should've said what might've caused that or how to fix it. > The exception: > {code} > scala> val model = cv.fit(df) > java.lang.UnsupportedOperationException: empty.max > at scala.collection.TraversableOnce$class.max(TraversableOnce.scala:227) > at scala.collection.AbstractTraversable.max(Traversable.scala:104) > at > org.apache.spark.ml.classification.MultiClassSummarizer.numClasses(LogisticRegression.scala:739) > at > org.apache.spark.ml.classification.MultiClassSummarizer.histogram(LogisticRegression.scala:743) > at > org.apache.spark.ml.classification.LogisticRegression.train(LogisticRegression.scala:288) > at > org.apache.spark.ml.classification.LogisticRegression.train(LogisticRegression.scala:261) > at > org.apache.spark.ml.classification.LogisticRegression.train(LogisticRegression.scala:160) > at org.apache.spark.ml.Predictor.fit(Predictor.scala:90) > at org.apache.spark.ml.Predictor.fit(Predictor.scala:71) > at org.apache.spark.ml.Estimator.fit(Estimator.scala:59) > at org.apache.spark.ml.Estimator$$anonfun$fit$1.apply(Estimator.scala:78) > at org.apache.spark.ml.Estimator$$anonfun$fit$1.apply(Estimator.scala:78) > at > scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245) > at > scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245) > at > scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33) > at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:186) > at scala.collection.TraversableLike$class.map(TraversableLike.scala:245) > at scala.collection.mutable.ArrayOps$ofRef.map(ArrayOps.scala:186) > at org.apache.spark.ml.Estimator.fit(Estimator.scala:78) > at > org.apache.spark.ml.tuning.CrossValidator$$anonfun$fit$1.apply(CrossValidator.scala:110) > at > org.apache.spark.ml.tuning.CrossValidator$$anonfun$fit$1.apply(CrossValidator.scala:105) > at > scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33) > at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:186) > at org.apache.spark.ml.tuning.CrossValidator.fit(CrossValidator.scala:105) > ... 55 elided > {code} > The code: > {code} > import org.apache.spark.ml.tuning._ > val cv = new CrossValidator > import org.apache.spark.mllib.linalg._ > val features = Vectors.sparse(3, Array(1), Array(1d)) > val df = Seq((0, "hello world", 0d, features)).toDF("id", "text", "label", > "features") > import org.apache.spark.ml.classification._ > val lr = new LogisticRegression() > import org.apache.spark.ml.evaluation.RegressionEvaluator > val regEval = new RegressionEvaluator() > val paramGrid = new ParamGridBuilder().build() > cv.setEstimatorParamMaps(paramGrid).setEstimator(lr).setEvaluator(regEval) > val model = cv.fit(df) > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org