Skip to content

Commit 0a95085

Browse files
committed
[SPARK-5496][MLLIB] Allow both classification and Classification in Algo for trees.
to be backward compatible. Author: Xiangrui Meng <[email protected]> Closes #4287 from mengxr/SPARK-5496 and squashes the following commits: a025c53 [Xiangrui Meng] Allow both classification and Classification in Algo for trees.
1 parent 54d9575 commit 0a95085

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

mllib/src/main/scala/org/apache/spark/mllib/tree/configuration/Algo.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ object Algo extends Enumeration {
2929
val Classification, Regression = Value
3030

3131
private[mllib] def fromString(name: String): Algo = name match {
32-
case "classification" => Classification
33-
case "regression" => Regression
32+
case "classification" | "Classification" => Classification
33+
case "regression" | "Regression" => Regression
3434
case _ => throw new IllegalArgumentException(s"Did not recognize Algo name: $name")
3535
}
3636
}

mllib/src/test/scala/org/apache/spark/mllib/tree/GradientBoostedTreesSuite.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,11 @@ class GradientBoostedTreesSuite extends FunSuite with MLlibTestSparkContext {
128128
}
129129
}
130130

131+
test("SPARK-5496: BoostingStrategy.defaultParams should recognize Classification") {
132+
for (algo <- Seq("classification", "Classification", "regression", "Regression")) {
133+
BoostingStrategy.defaultParams(algo)
134+
}
135+
}
131136
}
132137

133138
object GradientBoostedTreesSuite {

0 commit comments

Comments
 (0)