Description
val numClasses = getNumClasses(dataset) in NaiveBayes are used to check the length of thresholds only when positiveLabel && isDefined(thresholds) is true.
In the case that positiveLabel is true and isDefined(thresholds) is false, we don't need to calculate getNumClasses which may cause a pass on the whole data.