You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by gu...@apache.org on 2022/04/17 23:55:11 UTC
[spark] branch branch-3.3 updated: [SPARK-38816][ML][DOCS] Fix comment about choice of initial factors in ALS
This is an automated email from the ASF dual-hosted git repository.
gurwls223 pushed a commit to branch branch-3.3
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/branch-3.3 by this push:
new 6d23b40273a [SPARK-38816][ML][DOCS] Fix comment about choice of initial factors in ALS
6d23b40273a is described below
commit 6d23b40273a84c9e65f2d78af312956954e47897
Author: Sean Owen <sr...@gmail.com>
AuthorDate: Mon Apr 18 08:54:45 2022 +0900
[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 #36228 from srowen/SPARK-38816.
Authored-by: Sean Owen <sr...@gmail.com>
Signed-off-by: Hyukjin Kwon <gu...@apache.org>
(cherry picked from commit b2b350b1566b8b45c6dba2f79ccbc2dc4e95816d)
Signed-off-by: Hyukjin Kwon <gu...@apache.org>
---
mllib/src/main/scala/org/apache/spark/ml/recommendation/ALS.scala | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/mllib/src/main/scala/org/apache/spark/ml/recommendation/ALS.scala b/mllib/src/main/scala/org/apache/spark/ml/recommendation/ALS.scala
index a0ddf7129c9..35c9cca3d7a 100644
--- a/mllib/src/main/scala/org/apache/spark/ml/recommendation/ALS.scala
+++ b/mllib/src/main/scala/org/apache/spark/ml/recommendation/ALS.scala
@@ -1268,9 +1268,8 @@ object ALS extends DefaultParamsReadable[ALS] with Logging {
inBlocks: RDD[(Int, InBlock[ID])],
rank: Int,
seed: Long): RDD[(Int, FactorBlock)] = {
- // Choose a unit vector uniformly at random from the unit sphere, but from the
- // "first quadrant" where all elements are nonnegative. This can be done by choosing
- // elements distributed as Normal(0,1) and taking the absolute value, and then normalizing.
+ // Choose a unit vector uniformly at random from the unit sphere. This can be done by choosing
+ // elements distributed as Normal(0,1), and then normalizing.
// This appears to create factorizations that have a slightly better reconstruction
// (<1%) compared picking elements uniformly at random in [0,1].
inBlocks.mapPartitions({ iter =>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org