Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
DB Tsai committed Nov 25, 2014
1 parent 5bffd3d commit fc795e4
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,14 @@ class StandardScalerModel private[mllib] (
*/
override def transform(vector: Vector): Vector = {
require(mean.size == vector.size)
val localFactor = factor
if (withMean) {
val localShift = shift
vector match {
case dv: DenseVector =>
val values = dv.values.clone()
var i = 0
if(withStd) {
val localFactor = factor
while (i < values.length) {
values(i) = (values(i) - localShift(i)) * localFactor(i)
i += 1
Expand All @@ -118,6 +118,7 @@ class StandardScalerModel private[mllib] (
case v => throw new IllegalArgumentException("Do not support vector type " + v.getClass)
}
} else if (withStd) {
val localFactor = factor
vector match {
case dv: DenseVector =>
val values = dv.values.clone()
Expand Down

0 comments on commit fc795e4

Please sign in to comment.