Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ abstract class LDAModel private[ml] (
Vectors.zeros(k)
} else {
val (ids: List[Int], cts: Array[Double]) = vector match {
case v: DenseVector => ((0 until v.size).toList, v.values)
case v: DenseVector => (List.range(0, v.size), v.values)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update the PR title or remove this from this PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is OK, as it mirrors a similar change (optimization) we made in the previous PR. You're right it's orthogonal to the typo fix, but will be fine to add.

case v: SparseVector => (v.indices.toList, v.values)
case other =>
throw new UnsupportedOperationException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ class StandardScalerModel private[ml] (
case d: DenseVector => d.values.clone()
case v: Vector => v.toArray
}
val newValues = scaler.transfromWithMean(values)
val newValues = scaler.transformWithMean(values)
Vectors.dense(newValues)
} else if ($(withStd)) {
vector: Vector =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class StandardScalerModel @Since("1.3.0") (
case d: DenseVector => d.values.clone()
case v: Vector => v.toArray
}
val newValues = transfromWithMean(values)
val newValues = transformWithMean(values)
Vectors.dense(newValues)
} else if (withStd) {
vector match {
Expand All @@ -161,7 +161,7 @@ class StandardScalerModel @Since("1.3.0") (
}
}

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