Skip to content

Commit b2b350b

Browse files
srowenHyukjinKwon
authored andcommitted
[SPARK-38816][ML][DOCS] Fix comment about choice of initial factors in ALS
### What changes were proposed in this pull request? Change a comment in ALS code to match impl. The comment refers to taking the absolute value of a Normal(0,1) value, but it doesn't. ### Why are the changes needed? The docs and impl are inconsistent. The current behavior actually seems fine, desirable, so, change the comments. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Existing tests Closes apache#36228 from srowen/SPARK-38816. Authored-by: Sean Owen <srowen@gmail.com> Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
1 parent c34140d commit b2b350b

File tree

1 file changed

+2
-3
lines changed
  • mllib/src/main/scala/org/apache/spark/ml/recommendation

1 file changed

+2
-3
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,9 +1279,8 @@ object ALS extends DefaultParamsReadable[ALS] with Logging {
12791279
inBlocks: RDD[(Int, InBlock[ID])],
12801280
rank: Int,
12811281
seed: Long): RDD[(Int, FactorBlock)] = {
1282-
// Choose a unit vector uniformly at random from the unit sphere, but from the
1283-
// "first quadrant" where all elements are nonnegative. This can be done by choosing
1284-
// elements distributed as Normal(0,1) and taking the absolute value, and then normalizing.
1282+
// Choose a unit vector uniformly at random from the unit sphere. This can be done by choosing
1283+
// elements distributed as Normal(0,1), and then normalizing.
12851284
// This appears to create factorizations that have a slightly better reconstruction
12861285
// (<1%) compared picking elements uniformly at random in [0,1].
12871286
inBlocks.mapPartitions({ iter =>

0 commit comments

Comments
 (0)