Package

org.apache.spark.mllib

recommendation

Permalink

package recommendation

Visibility
  1. Public
  2. All

Type Members

  1. class ALS extends Serializable with Logging

    Permalink

    Alternating Least Squares matrix factorization.

    Alternating Least Squares matrix factorization.

    ALS attempts to estimate the ratings matrix R as the product of two lower-rank matrices, X and Y, i.e. X * Yt = R. Typically these approximations are called 'factor' matrices. The general approach is iterative. During each iteration, one of the factor matrices is held constant, while the other is solved for using least squares. The newly-solved factor matrix is then held constant while solving for the other factor matrix.

    This is a blocked implementation of the ALS factorization algorithm that groups the two sets of factors (referred to as "users" and "products") into blocks and reduces communication by only sending one copy of each user vector to each product block on each iteration, and only for the product blocks that need that user's feature vector. This is achieved by precomputing some information about the ratings matrix to determine the "out-links" of each user (which blocks of products it will contribute to) and "in-link" information for each product (which of the feature vectors it receives from each user block it will depend on). This allows us to send only an array of feature vectors between each user block and product block, and have the product block find the users' ratings and update the products based on these messages.

    For implicit preference data, the algorithm used is based on "Collaborative Filtering for Implicit Feedback Datasets", available at here, adapted for the blocked approach used here.

    Essentially instead of finding the low-rank approximations to the rating matrix R, this finds the approximations for a preference matrix P where the elements of P are 1 if r > 0 and 0 if r <= 0. The ratings then act as 'confidence' values related to strength of indicated user preferences rather than explicit ratings given to items.

    Annotations
    @Since( "0.8.0" )
  2. class MatrixFactorizationModel extends Saveable with Serializable with Logging

    Permalink

    Model representing the result of matrix factorization.

    Model representing the result of matrix factorization.

    Annotations
    @Since( "0.8.0" )
    Note

    If you create the model directly using constructor, please be aware that fast prediction requires cached user/product features and their associated partitioners.

  3. case class Rating(user: Int, product: Int, rating: Double) extends Product with Serializable

    Permalink

    A more compact class to represent a rating than Tuple3[Int, Int, Double].

    A more compact class to represent a rating than Tuple3[Int, Int, Double].

    Annotations
    @Since( "0.8.0" )

Value Members

  1. object ALS extends Serializable

    Permalink

    Top-level methods for calling Alternating Least Squares (ALS) matrix factorization.

    Top-level methods for calling Alternating Least Squares (ALS) matrix factorization.

    Annotations
    @Since( "0.8.0" )
  2. object MatrixFactorizationModel extends Loader[MatrixFactorizationModel] with Serializable

    Permalink
    Annotations
    @Since( "1.3.0" )

Ungrouped