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

    https://github.com/apache/spark/pull/14519#discussion_r73787877
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/ml/regression/AFTSurvivalRegression.scala 
---
    @@ -583,19 +591,22 @@ private class AFTAggregator(
     private class AFTCostFun(
         data: RDD[AFTPoint],
         fitIntercept: Boolean,
    -    featuresStd: Array[Double]) extends DiffFunction[BDV[Double]] {
    +    bcFeaturesStd: Broadcast[Array[Double]]) extends 
DiffFunction[BDV[Double]] {
     
       override def calculate(parameters: BDV[Double]): (Double, BDV[Double]) = 
{
     
    +    val bcParameters = data.context.broadcast(parameters)
    +
         val aftAggregator = data.treeAggregate(
    -      new AFTAggregator(parameters, fitIntercept, featuresStd))(
    +      new AFTAggregator(bcParameters, fitIntercept, bcFeaturesStd))(
           seqOp = (c, v) => (c, v) match {
             case (aggregator, instance) => aggregator.add(instance)
           },
           combOp = (c1, c2) => (c1, c2) match {
             case (aggregator1, aggregator2) => aggregator1.merge(aggregator2)
           })
     
    --- End diff --
    
    No need (c, v) match {...} pattern, directly use `(aggregator, instance) => 
aggregator.add(instance)`


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