Skip to content

Commit eb8fcbe

Browse files
committed
minor code style updates
1 parent cd2c2b4 commit eb8fcbe

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

mllib/src/main/scala/org/apache/spark/mllib/tree/DecisionTree.scala

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
package org.apache.spark.mllib.tree
1919

20-
import org.apache.spark.SparkContext._
2120
import scala.util.control.Breaks._
21+
import org.apache.spark.SparkContext._
2222
import org.apache.spark.rdd.RDD
2323
import org.apache.spark.mllib.tree.model._
2424
import org.apache.spark.{SparkContext, Logging}
@@ -101,7 +101,6 @@ class DecisionTree private(val strategy: Strategy) extends Serializable with Log
101101
val decisionTreeModel = {
102102
return new DecisionTreeModel(topNode, strategy.algo)
103103
}
104-
105104
return decisionTreeModel
106105
}
107106

@@ -538,10 +537,10 @@ object DecisionTree extends Serializable with Logging {
538537
}
539538

540539
if (leftCount == 0) {
541-
return new InformationGainStats(0,topImpurity,Double.MinValue,topImpurity,1)
540+
return new InformationGainStats(0, topImpurity, Double.MinValue, topImpurity,1)
542541
}
543542
if (rightCount == 0) {
544-
return new InformationGainStats(0,topImpurity,topImpurity,Double.MinValue,0)
543+
return new InformationGainStats(0, topImpurity, topImpurity, Double.MinValue,0)
545544
}
546545

547546
val leftImpurity = strategy.impurity.calculate(left0Count, left1Count)
@@ -561,7 +560,7 @@ object DecisionTree extends Serializable with Logging {
561560
//val predict = leftCount / (leftCount + rightCount)
562561
val predict = (left1Count + right1Count) / (leftCount + rightCount)
563562

564-
new InformationGainStats(gain,impurity,leftImpurity,rightImpurity,predict)
563+
new InformationGainStats(gain, impurity, leftImpurity, rightImpurity, predict)
565564
}
566565
case Regression => {
567566
val leftCount = leftNodeAgg(featureIndex)(3 * splitIndex)
@@ -584,12 +583,12 @@ object DecisionTree extends Serializable with Logging {
584583
}
585584

586585
if (leftCount == 0) {
587-
return new InformationGainStats(0,topImpurity,Double.MinValue,topImpurity,
586+
return new InformationGainStats(0, topImpurity, Double.MinValue, topImpurity,
588587
rightSum/rightCount)
589588
}
590589
if (rightCount == 0) {
591-
return new InformationGainStats(0,topImpurity,topImpurity,
592-
Double.MinValue,leftSum/leftCount)
590+
return new InformationGainStats(0, topImpurity ,topImpurity,
591+
Double.MinValue, leftSum/leftCount)
593592
}
594593

595594
val leftImpurity = strategy.impurity.calculate(leftCount, leftSum, leftSumSquares)
@@ -1024,7 +1023,4 @@ object DecisionTree extends Serializable with Logging {
10241023
.mean()
10251024
meanSumOfSquares
10261025
}
1027-
1028-
1029-
10301026
}

0 commit comments

Comments
 (0)