We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent daf2b06 commit 85885a9Copy full SHA for 85885a9
mllib/src/main/scala/org/apache/spark/mllib/feature/StandardScaler.scala
@@ -85,7 +85,10 @@ class StandardScalerModel private[mllib] (
85
f
86
}
87
88
- private val shift: Array[Double] = mean.toArray
+ // Since `shift` will be only used in `withMean` branch, we have it as
89
+ // `lazy val` so it will be evaluated in that branch. Note that we don't
90
+ // want to create this array multiple times in `transform` function.
91
+ private lazy val shift: Array[Double] = mean.toArray
92
93
/**
94
* Applies standardization transformation on a vector.
0 commit comments