File tree Expand file tree Collapse file tree 3 files changed +5
-9
lines changed
main/scala/org/apache/spark/mllib/tree
test/scala/org/apache/spark/mllib/tree Expand file tree Collapse file tree 3 files changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -929,7 +929,7 @@ object DecisionTree extends Serializable with Logging {
929929 }
930930 }.maxBy(_._2.gain)
931931
932- require (predict.isDefined, " must calculate predict for each node" )
932+ assert (predict.isDefined, " must calculate predict for each node" )
933933
934934 (bestSplit, bestSplitStats, predict.get)
935935 }
Original file line number Diff line number Diff line change 1717
1818package org .apache .spark .mllib .tree .model
1919
20- import org .apache .spark .annotation .DeveloperApi
21-
2220/**
23- * :: DeveloperApi ::
2421 * Predicted value for a node
2522 * @param predict predicted value
2623 * @param prob probability of the label (classification only)
2724 */
28- @ DeveloperApi
2925private [tree] class Predict (
3026 val predict : Double ,
31- val prob : Double = 0.0 ) extends Serializable {
27+ val prob : Double = 0.0 ) extends Serializable {
3228
3329 override def toString = {
3430 " predict = %f, prob = %f" .format(predict, prob)
Original file line number Diff line number Diff line change @@ -706,8 +706,8 @@ class DecisionTreeSuite extends FunSuite with LocalSparkContext {
706706 assert(bestInfoStats == InformationGainStats .invalidInformationGainStats)
707707 }
708708
709- test(" don't choose split that doesn't satisfy min instance per node requirements" ) {
710- // if a split doesn't satisfy min instances per node requirements,
709+ test(" do not choose split that does not satisfy min instance per node requirements" ) {
710+ // if a split does not satisfy min instances per node requirements,
711711 // this split is invalid, even though the information gain of split is large.
712712 val arr = new Array [LabeledPoint ](4 )
713713 arr(0 ) = new LabeledPoint (0.0 , Vectors .dense(0.0 , 1.0 ))
@@ -727,7 +727,7 @@ class DecisionTreeSuite extends FunSuite with LocalSparkContext {
727727
728728 assert(bestSplits.length == 1 )
729729 val bestSplit = bestSplits(0 )._1
730- val bestSplitStats = bestSplits(0 )._1
730+ val bestSplitStats = bestSplits(0 )._2
731731 assert(bestSplit.feature == 1 )
732732 assert(bestSplitStats != InformationGainStats .invalidInformationGainStats)
733733 }
You can’t perform that action at this time.
0 commit comments