You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by srowen <gi...@git.apache.org> on 2017/05/01 09:42:48 UTC

[GitHub] spark pull request #17556: [SPARK-16957][MLlib] Use midpoints for split valu...

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

    https://github.com/apache/spark/pull/17556#discussion_r114112732
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/tree/impl/RandomForest.scala ---
    @@ -1009,10 +1009,24 @@ private[spark] object RandomForest extends Logging {
           // sort distinct values
           val valueCounts = valueCountMap.toSeq.sortBy(_._1).toArray
     
    -      // if possible splits is not enough or just enough, just return all possible splits
    +      // perhaps weighted mean is better in the future, see SPARK-16957 and Github PR 17556.
    +      def mean(pre: (Double, Int), cur: (Double, Int)): Double = {
    +        val (preValue, preCount) = pre
    --- End diff --
    
    Is it worth factoring a method for this? you could just write `(preValue, _) =` here, but, just dereferncing `._1` isn't so bad, and then, wondering if it saves much to make a method.


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

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