Skip to content

Commit aa41dce

Browse files
zhengruifengdongjoon-hyun
authored andcommitted
[SPARK-28159][ML][FOLLOWUP] fix typo & (0 until v.size).toList => List.range(0, v.size)
## What changes were proposed in this pull request? fix typo in spark-28159 `transfromWithMean` -> `transformWithMean` ## How was this patch tested? existing test Closes apache#25129 from zhengruifeng/to_ml_vec_cleanup. Authored-by: zhengruifeng <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
1 parent 687dd4e commit aa41dce

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

mllib/src/main/scala/org/apache/spark/ml/clustering/LDA.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ abstract class LDAModel private[ml] (
490490
Vectors.zeros(k)
491491
} else {
492492
val (ids: List[Int], cts: Array[Double]) = vector match {
493-
case v: DenseVector => ((0 until v.size).toList, v.values)
493+
case v: DenseVector => (List.range(0, v.size), v.values)
494494
case v: SparseVector => (v.indices.toList, v.values)
495495
case other =>
496496
throw new UnsupportedOperationException(

mllib/src/main/scala/org/apache/spark/ml/feature/StandardScaler.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ class StandardScalerModel private[ml] (
169169
case d: DenseVector => d.values.clone()
170170
case v: Vector => v.toArray
171171
}
172-
val newValues = scaler.transfromWithMean(values)
172+
val newValues = scaler.transformWithMean(values)
173173
Vectors.dense(newValues)
174174
} else if ($(withStd)) {
175175
vector: Vector =>

mllib/src/main/scala/org/apache/spark/mllib/feature/StandardScaler.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ class StandardScalerModel @Since("1.3.0") (
141141
case d: DenseVector => d.values.clone()
142142
case v: Vector => v.toArray
143143
}
144-
val newValues = transfromWithMean(values)
144+
val newValues = transformWithMean(values)
145145
Vectors.dense(newValues)
146146
} else if (withStd) {
147147
vector match {
@@ -161,7 +161,7 @@ class StandardScalerModel @Since("1.3.0") (
161161
}
162162
}
163163

164-
private[spark] def transfromWithMean(values: Array[Double]): Array[Double] = {
164+
private[spark] def transformWithMean(values: Array[Double]): Array[Double] = {
165165
// By default, Scala generates Java methods for member variables. So every time when
166166
// the member variables are accessed, `invokespecial` will be called which is expensive.
167167
// This can be avoid by having a local reference of `shift`.

0 commit comments

Comments
 (0)