Github user shahidki31 commented on a diff in the pull request:
https://github.com/apache/spark/pull/21740#discussion_r202547705
--- Diff:
mllib/src/main/scala/org/apache/spark/mllib/recommendation/MatrixFactorizationModel.scala
---
@@ -75,11 +75,29 @@ class MatrixFactorizationModel @Since("0.8.0") (
}
}
+ /** Validates the user and return the feature corresponding to the user.
*/
+ private def validateAndGetUser(user: Int): Array[Double] = {
+ userFeatures.lookup(user) match {
+ case userFeature: Seq[Array[Double]] =>
--- End diff --
Thank you for the comment.
I have removed both the methods. Because each method has to give distinct
exception, like "user not found" in the first method and "product not found" in
the second method. So, it is better to remove the methods, instead of making
one.
I have added the validation code inside the methods such as predict,
recommendProduct etc.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]