Github user davies commented on a diff in the pull request:
https://github.com/apache/spark/pull/3095#discussion_r19846471
--- Diff:
mllib/src/main/scala/org/apache/spark/mllib/recommendation/ALS.scala ---
@@ -700,6 +700,32 @@ object ALS {
* Train a matrix factorization model given an RDD of ratings given by
users to some products,
* in the form of (userID, productID, rating) pairs. We approximate the
ratings matrix as the
* product of two lower-rank matrices of a given rank (number of
features). To solve for these
+ * features, we run a given number of iterations of ALS. This is done
using a level of
+ * parallelism given by `blocks`.
+ *
+ * @param ratings RDD of (userID, productID, rating) pairs
+ * @param rank number of features to use
+ * @param iterations number of iterations of ALS (recommended: 10-20)
+ * @param lambda regularization factor (recommended: 0.01)
+ * @param blocks level of parallelism to split computation into
+ * @param nonnegative whether to enforce nonnegativity
+ */
+ def train(
+ ratings: RDD[Rating],
+ rank: Int,
+ iterations: Int,
+ lambda: Double,
+ blocks: Int,
+ nonnegative: Boolean
+ ): MatrixFactorizationModel = {
+ (new ALS(blocks, blocks, rank, iterations, lambda, false, 1.0)
+ .setNonnegative(nonnegative).run(ratings))
--- End diff --
NonNegative and seed can not be set in same time, do we need to fix this?
---
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]