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-5436] [MLlib] Validate GradientBoostedT...
Date Mon, 23 Feb 2015 21:55:42 GMT
Github user jkbradley commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4677#discussion_r25206510
  
    --- Diff: mllib/src/main/scala/org/apache/spark/mllib/tree/GradientBoostedTrees.scala
---
    @@ -177,6 +224,23 @@ object GradientBoostedTrees extends Logging {
           val partialModel = new GradientBoostedTreesModel(
             Regression, baseLearners.slice(0, m + 1), baseLearnerWeights.slice(0, m + 1))
           logDebug("error of gbt = " + loss.computeError(partialModel, input))
    +
    +      if (validate) {
    +        // Stop training early if
    +        // 1. Reduction in error is less than the validationTol or
    +        // 2. If the error increases, that is if the model is overfit.
    +        // We want the model returned corresponding to the best validation error.
    +        val currentValidateError = loss.computeError(partialModel, validationInput)
    +        if (bestValidateError - currentValidateError < validationTol) {
    +          return new GradientBoostedTreesModel(
    +            boostingStrategy.treeStrategy.algo,
    +            baseLearners.slice(0, bestM),
    +            baseLearnerWeights.slice(0, bestM))
    +        } else if (currentValidateError < bestValidateError){
    --- End diff --
    
    scala style: space before {


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