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

    https://github.com/apache/spark/pull/1687#discussion_r15645545
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/mllib/recommendation/MatrixFactorizationModel.scala
 ---
    @@ -66,6 +66,42 @@ class MatrixFactorizationModel private[mllib] (
       }
     
       /**
    +   * Recommends products to users.
    +   *
    +   * @param user the user to recommend products to
    +   * @param howMany how many products to return. The number returned may 
be less than this.
    +   * @return product ID and score tuples, sorted descending by score. The 
first product returned
    +   *  is the one predicted to be most strongly recommended to the user. 
The score is an opaque
    +   *  value that indicates how strongly recommended the product is.
    +   */
    +  def recommendProducts(user: Int, howMany: Int = 10): Array[(Int,Double)] 
=
    +    recommend(userFeatures.lookup(user).head, productFeatures, howMany)
    +
    +  /**
    +   * Recommends users to products. That is, this returns users who are 
most likely to be
    +   * interested in a product.
    +   *
    +   * @param product the product to recommend users to
    +   * @param howMany how many users to return. The number returned may be 
less than this.
    +   * @return user ID and score tuples, sorted descending by score. The 
first user returned
    +   *  is the one predicted to be most strongly interested in the product. 
The score is an opaque
    +   *  value that indicates how strongly interested the user is.
    +   */
    +  def recommendUsers(product: Int, howMany: Int = 10): Array[(Int,Double)] 
=
    --- End diff --
    
    space after `Int,`


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

Reply via email to