zhengruifeng commented on a change in pull request #25926: [SPARK-9612][ML] Add instance weight support for GBTs URL: https://github.com/apache/spark/pull/25926#discussion_r328916510
########## File path: mllib/src/test/scala/org/apache/spark/ml/regression/GBTRegressorSuite.scala ########## @@ -296,6 +304,35 @@ class GBTRegressorSuite extends MLTest with DefaultReadWriteTest { } } + test("training with sample weights") { + val df = linearRegressionData + val numClasses = 0 + // (maxIter, maxDepth) + val testParams = Seq( + (5, 5), + (5, 10) + ) + + for ((maxIter, maxDepth) <- testParams) { + val estimator = new GBTRegressor() + .setMaxIter(maxIter) + .setMaxDepth(maxDepth) + .setSeed(seed) + .setMinWeightFractionPerNode(0.1) + + MLTestingUtils.testArbitrarilyScaledWeights[GBTRegressionModel, + GBTRegressor](df.as[LabeledPoint], estimator, + MLTestingUtils.modelPredictionEquals(df, _ ~= _ relTol 0.1, 0.95)) Review comment: Compared to `DecisionTreeRegressorSuite`, I need to limit the number of trees and loose the tolerance eps(0.99 -> 0.95) to pass the cases. I wonder if it is due to accumulated errors among trees. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org