spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jkbradley <...@git.apache.org>
Subject [GitHub] spark pull request: [SPARK-5972] [MLlib] Cache residuals and gradi...
Date Thu, 02 Apr 2015 21:44:29 GMT
Github user jkbradley commented on a diff in the pull request:

    https://github.com/apache/spark/pull/5330#discussion_r27700316
  
    --- Diff: mllib/src/main/scala/org/apache/spark/mllib/tree/model/treeEnsembleModels.scala
---
    @@ -143,17 +141,9 @@ class GradientBoostedTreesModel(
         val broadcastWeights = sc.broadcast(treeWeights)
     
         (1 until numIterations).map { nTree =>
    -      predictionAndError = remappedData.zip(predictionAndError).mapPartitions { iter
=>
    -        val currentTree = broadcastTrees.value(nTree)
    -        val currentTreeWeight = broadcastWeights.value(nTree)
    -        iter.map {
    -          case (point, (pred, error)) => {
    -            val newPred = pred + currentTree.predict(point.features) * currentTreeWeight
    -            val newError = loss.computeError(newPred, point.label)
    -            (newPred, newError)
    -          }
    -        }
    -      }
    +      predictionAndError = GradientBoostedTreesModel.updatePredictionError(
    +        remappedData, predictionAndError, broadcastWeights.value(nTree),
    --- End diff --
    
    You should pass the broadcast variables themselves; don't extract the value here since
this happens before the mapPartitions().


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


Mime
View raw message