Github user mengxr commented on a diff in the pull request:
https://github.com/apache/spark/pull/3095#discussion_r19988621
--- Diff:
mllib/src/main/scala/org/apache/spark/mllib/api/python/PythonMLLibAPI.scala ---
@@ -278,8 +278,18 @@ class PythonMLLibAPI extends Serializable {
rank: Int,
iterations: Int,
lambda: Double,
- blocks: Int): MatrixFactorizationModel = {
- new MatrixFactorizationModelWrapper(ALS.train(ratings.rdd, rank,
iterations, lambda, blocks))
+ blocks: Int,
+ nonnegative: Boolean,
+ seed: java.lang.Long): MatrixFactorizationModel = {
+ if (seed == null) {
+ new MatrixFactorizationModelWrapper(
+ // if the seed coming from python is None/null, let ALS use the
+ // default, which is to use System.nanoTime
+ ALS.train(ratings.rdd, rank, iterations, lambda, blocks,
nonnegative))
--- End diff --
Let's use setters so we don't need to add many static methods.
~~~
val als = new ALS()
.setRank(rank)
.setIterations(iterations)
.setLambda(lambda)
.setBlocks(blocks)
.setNonnegative(nonnegative)
if (seed != null) als.setSeed(seed)
val model = als.run(ratings.rdd)
new MatrixFactorizationModelWrapper(model)
~~~
---
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]