Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ private[spark] class DecisionTreeMetadata(

def isMulticlass: Boolean = numClasses > 2

def isMulticlassWithCategoricalFeatures: Boolean = isMulticlass && (featureArity.size > 0)
def isMulticlassWithCategoricalFeatures: Boolean = isMulticlass && (featureArity.nonEmpty)

def isCategorical(featureIndex: Int): Boolean = featureArity.contains(featureIndex)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ private[ml] object TreeEnsembleModel {
maxFeatureIndex + 1
}
if (d == 0) {
assert(totalImportances.size == 0, s"Unknown error in computing feature" +
assert(totalImportances.isEmpty, s"Unknown error in computing feature" +
s" importance: No splits found, but some non-zero importances.")
}
val (indices, values) = totalImportances.iterator.toSeq.sortBy(_._1).unzip
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class Strategy @Since("1.3.0") (
*/
@Since("1.2.0")
def isMulticlassWithCategoricalFeatures: Boolean = {
isMulticlassClassification && (categoricalFeaturesInfo.size > 0)
isMulticlassClassification && (categoricalFeaturesInfo.nonEmpty)
}

// scalastyle:off argcount
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -995,8 +995,8 @@ class ALSSuite extends MLTest with DefaultReadWriteTest with Logging {
val shuffledItemFactors = getShuffledDependencies(itemFactors.rdd).filter { dep =>
dep.rdd.name != null && dep.rdd.name.contains("itemFactors")
}
assert(shuffledUserFactors.size == 0)
assert(shuffledItemFactors.size == 0)
assert(shuffledUserFactors.isEmpty)
assert(shuffledItemFactors.isEmpty)
}

private def checkRecommendations(
Expand Down