Skip to content

Commit

Permalink
[MLLIB][tree] Use a rdd api to verify size of input rdd > 0 when buil…
Browse files Browse the repository at this point in the history
…ding meta data

Use rdd api isEmpty
  • Loading branch information
Alain committed Apr 30, 2015
1 parent b448f47 commit cf2e567
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ private[tree] object DecisionTreeMetadata extends Logging {
numTrees: Int,
featureSubsetStrategy: String): DecisionTreeMetadata = {

val numExamples = input.count()
require(numExamples > 0, s"DecisionTree requires size of input RDD > 0, " +
s"but was given by an empty one.")
require(!input.isEmpty, s"DecisionTree requires size of input RDD > 0, " +
s"but was given by an empty one.")

val numExamples = input.count()
val numFeatures = input.take(1)(0).features.size
val numClasses = strategy.algo match {
case Classification => strategy.numClasses
Expand Down

0 comments on commit cf2e567

Please sign in to comment.