mgaido91 commented on a change in pull request #25160: [SPARK-28399][ML] 
implement RobustScaler
URL: https://github.com/apache/spark/pull/25160#discussion_r305575349
 
 

 ##########
 File path: 
mllib/src/main/scala/org/apache/spark/ml/feature/StandardScaler.scala
 ##########
 @@ -245,4 +224,85 @@ object StandardScalerModel extends 
MLReadable[StandardScalerModel] {
 
   @Since("1.6.0")
   override def load(path: String): StandardScalerModel = super.load(path)
+
+  private[spark] def transformWithBoth(shift: Array[Double],
+                                       scale: Array[Double],
+                                       values: Array[Double]): Array[Double] = 
{
+    var i = 0
+    while (i < values.length) {
+      values(i) = (values(i) - shift(i)) * scale(i)
+      i += 1
+    }
+    values
+  }
+
+  private[spark] def transformWithShift(shift: Array[Double],
+                                        values: Array[Double]): Array[Double] 
= {
+    var i = 0
+    while (i < values.length) {
+      values(i) -= shift(i)
+      i += 1
+    }
+    values
+  }
+
+  private[spark] def transformDenseWithScale(scale: Array[Double],
+                                             values: Array[Double]): 
Array[Double] = {
+    var i = 0
+    while (i < values.length) {
+      values(i) *= scale(i)
+      i += 1
+    }
+    values
+  }
+
+  private[spark] def transformSparseWithScale(scale: Array[Double],
 
 Review comment:
   ditto

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

Reply via email to