Skip to content

Commit d984623

Browse files
committed
minor changes
1 parent 2fc1641 commit d984623

File tree

1 file changed

+4
-4
lines changed
  • mllib/src/main/scala/org/apache/spark/mllib/recommendation

1 file changed

+4
-4
lines changed

mllib/src/main/scala/org/apache/spark/mllib/recommendation/ALS.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -438,15 +438,15 @@ class ALS private (
438438
}
439439

440440
// Solve the least-squares problem for each user and return the new feature vectors
441-
userXtX.zip(userXy).map { case (triangularXtX, rhs) =>
441+
Array.range(0, numUsers).map { index =>
442442
// Compute the full XtX matrix from the lower-triangular part we got above
443-
fillFullMatrix(triangularXtX, fullXtX)
443+
fillFullMatrix(userXtX(index), fullXtX)
444444
// Add regularization
445445
(0 until rank).foreach(i => fullXtX.data(i*rank + i) += lambda)
446446
// Solve the resulting matrix, which is symmetric and positive-definite
447447
implicitPrefs match {
448-
case false => Solve.solvePositive(fullXtX, rhs).data
449-
case true => Solve.solvePositive(fullXtX.addi(YtY.value.get), rhs).data
448+
case false => Solve.solvePositive(fullXtX, userXy(index)).data
449+
case true => Solve.solvePositive(fullXtX.addi(YtY.value.get), userXy(index)).data
450450
}
451451
}
452452
}

0 commit comments

Comments
 (0)