Github user viirya commented on a diff in the pull request:

    https://github.com/apache/spark/pull/7121#discussion_r33569733
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/mllib/recommendation/MatrixFactorizationModel.scala
 ---
    @@ -89,10 +89,14 @@ class MatrixFactorizationModel(
        */
       def predict(usersProducts: RDD[(Int, Int)]): RDD[Rating] = {
         val users = userFeatures.join(usersProducts).map {
    -      case (user, (uFeatures, product)) => (product, (user, uFeatures))
    +      case (user, (uFeatures, product)) => ((user, product), uFeatures)
         }
    -    users.join(productFeatures).map {
    -      case (product, ((user, uFeatures), pFeatures)) =>
    +    val productUsers = usersProducts.map(up => (up._2, up._1))
    +    val products = productFeatures.join(productUsers).map {
    --- End diff --
    
    Yes. That is what I thought at the first. Also it will add the additional 
cost of calculating distinct numbers of users and products. Since the input 
parameter is a RDD of (userId, productId), to calculate that may require two 
distinct + count? Is it costing less than another join?


---
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]

Reply via email to