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

    https://github.com/apache/spark/pull/8246#discussion_r39185342
  
    --- 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))
    +      .map { case (k, v) => findSplits(k, v) }
    +      .collectAsMap()
    +
    +    val numFeatures = metadata.numFeatures
    +    val (splits, bins) = Range(0, numFeatures).unzip {
    +      case i if metadata.isContinuous(i) =>
    +        val (split, bin) = continuousSplits(i)
    +        metadata.setNumSplits(i, split.length)
    --- End diff --
    
    Can you please remove the similar call to this in 
findSplitsForContinuousFeature since that will now be run on workers?


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to