File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed
examples/src/main/python/mllib
mllib/src/main/scala/org/apache/spark/mllib/tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -124,7 +124,9 @@ def usage():
124124 (reindexedData , origToNewLabels ) = reindexClassLabels (points )
125125
126126 # Train a classifier.
127- model = DecisionTree .trainClassifier (reindexedData , numClasses = 2 )
127+ categoricalFeaturesInfo = {} # no categorical features
128+ model = DecisionTree .trainClassifier (reindexedData , numClasses = 2 ,
129+ categoricalFeaturesInfo = categoricalFeaturesInfo )
128130 # Print learned tree and stats.
129131 print "Trained DecisionTree for classification:"
130132 print " Model numNodes: %d\n " % model .numNodes ()
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import scala.collection.JavaConverters._
2222import org .apache .spark .annotation .Experimental
2323import org .apache .spark .api .java .JavaRDD
2424import org .apache .spark .Logging
25+ import org .apache .spark .mllib .rdd .RDDFunctions ._
2526import org .apache .spark .mllib .regression .LabeledPoint
2627import org .apache .spark .mllib .tree .configuration .Strategy
2728import org .apache .spark .mllib .tree .configuration .Algo ._
@@ -826,7 +827,7 @@ object DecisionTree extends Serializable with Logging {
826827 // Calculate bin aggregates.
827828 timer.start(" aggregation" )
828829 val binAggregates = {
829- input.aggregate (Array .fill[Double ](binAggregateLength)(0 ))(binSeqOp, binCombOp)
830+ input.treeAggregate (Array .fill[Double ](binAggregateLength)(0 ))(binSeqOp, binCombOp)
830831 }
831832 timer.stop(" aggregation" )
832833 logDebug(" binAggregates.length = " + binAggregates.length)
You can’t perform that action at this time.
0 commit comments