Github user manishamde commented on a diff in the pull request:

    https://github.com/apache/spark/pull/2435#discussion_r18064627
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/mllib/tree/DecisionTree.scala ---
    @@ -626,21 +510,30 @@ object DecisionTree extends Serializable with Logging 
{
          *
          * @param agg  Array storing aggregate calculation, with a set of 
sufficient statistics for
          *             each (node, feature, bin).
    -     * @param treePoint   Data point being aggregated.
    +     * @param baggedPoint   Data point being aggregated.
          * @return  agg
          */
         def binSeqOp(
             agg: DTStatsAggregator,
    -        treePoint: TreePoint): DTStatsAggregator = {
    -      val nodeIndex = treePointToNodeIndex(treePoint)
    -      // If the example does not reach this level, then nodeIndex < 0.
    -      // If the example reaches this level but is handled in a different 
group,
    -      //  then either nodeIndex < 0 (previous group) or nodeIndex >= 
numNodes (later group).
    -      if (nodeIndex >= 0 && nodeIndex < numNodes) {
    -        if (metadata.unorderedFeatures.isEmpty) {
    -          orderedBinSeqOp(agg, treePoint, nodeIndex)
    -        } else {
    -          mixedBinSeqOp(agg, treePoint, nodeIndex, bins, 
metadata.unorderedFeatures)
    +        baggedPoint: BaggedPoint[TreePoint]): DTStatsAggregator = {
    +      nodesForGroup.keys.foreach { treeIndex =>
    +        val nodeIndex = predictNodeIndex(topNodes(treeIndex), 
baggedPoint.datum.binnedFeatures,
    +          bins, metadata.unorderedFeatures)
    +        val aggNodeIndex = groupNodeIndex(treeIndex).getOrElse(nodeIndex, 
-1)
    --- End diff --
    
    contains and get possibly better than getOrElse and compare >= 0? 
Definitely more readable.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to