srowen commented on a change in pull request #25160: [SPARK-28399][ML]
implement RobustScaler
URL: https://github.com/apache/spark/pull/25160#discussion_r303926393
##########
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) {
Review comment:
Nit: space after while
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]