Github user shahidki31 commented on a diff in the pull request:
https://github.com/apache/spark/pull/21740#discussion_r202534469
--- Diff:
mllib/src/main/scala/org/apache/spark/mllib/recommendation/MatrixFactorizationModel.scala
---
@@ -75,10 +75,22 @@ class MatrixFactorizationModel @Since("0.8.0") (
}
}
+ /** Check for the invalid user. */
+ private def validateUser(user: Int): Unit = {
+ require(userFeatures.lookup(user).nonEmpty, s"userId: $user not found
in the model")
--- End diff --
I have renamed the method to 'validateAndGetUser', where it check, whether
the user exist or not and it returns the corresponding user feature. Similarly
for the product also.
Please let me know if anymore changes required.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]