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

    https://github.com/apache/spark/pull/5330#discussion_r28267768
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/mllib/tree/model/treeEnsembleModels.scala 
---
    @@ -166,6 +158,60 @@ class GradientBoostedTreesModel(
     
     object GradientBoostedTreesModel extends Loader[GradientBoostedTreesModel] 
{
     
    +  /**
    +   * Compute the initial predictions and errors for a dataset for the first
    +   * iteration of gradient boosting.
    +   * @param data: training data.
    +   * @param initTreeWeight: learning rate assigned to the first tree.
    +   * @param initTree: first DecisionTreeModel.
    +   * @param loss: evaluation metric.
    +   * @return a RDD with each element being a zip of the prediction and 
error
    +   *         corresponding to every sample.
    +   */
    +  def computeInitialPredictionAndError(
    +      data: RDD[LabeledPoint],
    +      initTreeWeight: Double,
    +      initTree: DecisionTreeModel,
    +      loss: Loss): RDD[(Double, Double)] = {
    +    data.map { lp =>
    +      val pred = initTreeWeight * initTree.predict(lp.features)
    +      val error = loss.computeError(pred, lp.label)
    +      (pred, error)
    +    }
    +  }
    +
    +  /**
    +   * Update a zipped predictionError RDD
    +   * (as obtained with computeInitialPredictionAndError)
    +   * @param data: training data.
    +   * @param predictionAndError: predictionError RDD
    +   * @param treeWeight: Learning rate.
    +   * @param tree: Tree using which the prediction and error should be 
updated.
    +   * @param loss: evaluation metric.
    +   * @return a RDD with each element being a zip of the prediction and 
error
    +   *         corresponding to each sample.
    +   */
    +  def updatePredictionError(
    +    data: RDD[LabeledPoint],
    +    predictionAndError: RDD[(Double, Double)],
    +    treeWeight: Double,
    +    tree: DecisionTreeModel,
    +    loss: Loss): RDD[(Double, Double)] = {
    +
    +    val sc = data.sparkContext
    --- End diff --
    
    no longer needed


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