Github user danielyli commented on a diff in the pull request:
https://github.com/apache/spark/pull/17793#discussion_r114038185
--- Diff: mllib/src/main/scala/org/apache/spark/ml/recommendation/ALS.scala
---
@@ -791,32 +813,43 @@ object ALS extends DefaultParamsReadable[ALS] with
Logging {
checkpointInterval: Int = 10,
seed: Long = 0L)(
implicit ord: Ordering[ID]): (RDD[(ID, Array[Float])], RDD[(ID,
Array[Float])]) = {
+
require(!ratings.isEmpty(), s"No ratings available from $ratings")
require(intermediateRDDStorageLevel != StorageLevel.NONE,
"ALS is not designed to run without persisting intermediate RDDs.")
+
val sc = ratings.sparkContext
+
+ // Precompute the rating dependencies of each partition
val userPart = new ALSPartitioner(numUserBlocks)
val itemPart = new ALSPartitioner(numItemBlocks)
- val userLocalIndexEncoder = new
LocalIndexEncoder(userPart.numPartitions)
- val itemLocalIndexEncoder = new
LocalIndexEncoder(itemPart.numPartitions)
- val solver = if (nonnegative) new NNLSSolver else new CholeskySolver
val blockRatings = partitionRatings(ratings, userPart, itemPart)
.persist(intermediateRDDStorageLevel)
val (userInBlocks, userOutBlocks) =
makeBlocks("user", blockRatings, userPart, itemPart,
intermediateRDDStorageLevel)
- // materialize blockRatings and user blocks
- userOutBlocks.count()
+ userOutBlocks.count() // materialize blockRatings and user blocks
--- End diff --
I moved the comment because the only other comment that has its own line,
`// Precompute the rating dependencies of each partition`, is serving as the
heading for this entire block of code, and having other whole-line comments in
this block is a bit of a mismatch. If you still feel reversion is necessary
though, just let me know.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]