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

    https://github.com/apache/spark/pull/8246#discussion_r38249912
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/mllib/tree/DecisionTree.scala ---
    @@ -1056,6 +988,70 @@ object DecisionTree extends Serializable with Logging 
{
         }
       }
     
    +  private def findSplitsBinsBySorting(
    +      input: RDD[LabeledPoint],
    +      metadata: DecisionTreeMetadata,
    +      continuousFeatures: IndexedSeq[Int]): (Array[Array[Split]], 
Array[Array[Bin]]) = {
    +    def findSplits(
    +        featureIndex: Int,
    +        featureSamples: Iterable[Double]): (Int, (Array[Split], 
Array[Bin])) = {
    +      val splits = {
    +        val featureSplits = findSplitsForContinuousFeature(
    +          featureSamples.toArray,
    +          metadata,
    +          featureIndex)
    +        logDebug(s"featureIndex = $featureIndex, numSplits = 
${featureSplits.length}")
    +
    +        featureSplits.map(threshold => new Split(featureIndex, threshold, 
Continuous, Nil))
    +      }
    +
    +      val bins = {
    +        val lowSplit = new DummyLowSplit(featureIndex, Continuous)
    +        val highSplit = new DummyHighSplit(featureIndex, Continuous)
    +        (lowSplit +: splits.toSeq :+ highSplit).sliding(2).map {
    +          case Seq(lhs, right) => new Bin(lhs, right, Continuous, 
Double.MinValue)
    +        }.toArray
    +      }
    +
    +      (featureIndex, (splits, bins))
    +    }
    +
    +    val continuousSplits = input
    +      .flatMap(point => continuousFeatures.map(idx => (idx, 
point.features(idx))))
    +      .groupByKey(numPartitions = math.min(continuousFeatures.length, 
input.partitions.length))
    --- End diff --
    
    numPartitions logic could be extracted out in a separate line and a small 
explanation would help.


---
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