Github user wangmiao1981 commented on a diff in the pull request: https://github.com/apache/spark/pull/12969#discussion_r62420025 --- Diff: mllib/src/main/scala/org/apache/spark/ml/classification/LogisticRegression.scala --- @@ -744,7 +744,13 @@ private[classification] class MultiClassSummarizer extends Serializable { def countInvalid: Long = totalInvalidCnt /** @return The number of distinct labels in the input dataset. */ - def numClasses: Int = distinctMap.keySet.max + 1 + def numClasses: Int = try { + distinctMap.keySet.max + 1 + } catch { + case e: UnsupportedOperationException => --- End diff -- I think returning 0 is reasonable. The inline comments of the JIRA, @jkbradley proposed the fix of throwing a better exception. I am glad to learn using require. Thanks!
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org