Class SVDPlusPlus


  • public class SVDPlusPlus
    extends Recommender
    Implements Koren, Y. (2008, August). Factorization meets the neighborhood: a multifaceted collaborative filtering model. In Proceedings of the 14th ACM SIGKDD international conference on Knowledge discovery and data mining (pp. 426-434).
    • Field Detail

      • numFactors

        protected final int numFactors
        Number of latent factors
      • numIters

        protected final int numIters
        Number of iterations
      • gamma

        protected final double gamma
        Learning rate hyper-parameter
      • lambda

        protected final double lambda
        Regularization hyper-parameter
      • bu

        protected final double[] bu
        bu parameter
      • bi

        protected final double[] bi
        bi parameter
      • p

        protected final double[][] p
        p parameter
      • q

        protected final double[][] q
        q parameter
      • y

        protected final double[][] y
        y parameter
    • Constructor Detail

      • SVDPlusPlus

        public SVDPlusPlus​(DataModel datamodel,
                           Map<String,​Object> params)
        Model constructor from a Map containing the model's hyper-parameters values. Map object must contains the following keys:
        • numFactors: int value with the number of latent factors.
        • numIters:: int value with the number of iterations.
        • gamma (optional): double value with the learning rate hyper-parameter. If missing, it is set to 0.01.
        • lambda (optional): double value with the regularization hyper-parameter. If missing, it is set to 0.05.
        • seed (optional): random seed for random numbers generation. If missing, random value is used.
        Parameters:
        datamodel - DataModel instance
        params - Model's hyper-parameters values
      • SVDPlusPlus

        public SVDPlusPlus​(DataModel datamodel,
                           int numFactors,
                           int numIters)
        Model constructor
        Parameters:
        datamodel - DataModel instance
        numFactors - Number of latent factors
        numIters - Number of iterations
      • SVDPlusPlus

        public SVDPlusPlus​(DataModel datamodel,
                           int numFactors,
                           int numIters,
                           long seed)
        Model constructor
        Parameters:
        datamodel - DataModel instance
        numFactors - Number of latent factors
        numIters - Number of iterations
        seed - Seed for random numbers generation
      • SVDPlusPlus

        public SVDPlusPlus​(DataModel datamodel,
                           int numFactors,
                           int numIters,
                           double gamma,
                           double lambda)
        Model constructor
        Parameters:
        datamodel - DataModel instance
        numFactors - Number of latent factors
        numIters - Number of iterations
        gamma - Learning rate hyper-parameter
        lambda - Regularization hyper-parameter
      • SVDPlusPlus

        public SVDPlusPlus​(DataModel datamodel,
                           int numFactors,
                           int numIters,
                           double gamma,
                           double lambda,
                           long seed)
        Model constructor
        Parameters:
        datamodel - DataModel instance
        numFactors - Number of latent factors
        numIters - Number of iterations
        gamma - Learning rate hyper-parameter
        lambda - Regularization hyper-parameter
        seed - Seed for random numbers generation
    • Method Detail

      • fit

        public void fit()
        Description copied from class: Recommender
        Estimates model parameters given the hyper-parameters
        Specified by:
        fit in class Recommender
      • predict

        public double predict​(int userIndex,
                              int itemIndex)
        Description copied from class: Recommender
        Computes a rating prediction
        Specified by:
        predict in class Recommender
        Parameters:
        userIndex - Index of the user in the array of Users of the DataModel instance
        itemIndex - Index of the item in the array of Items of the DataModel instance
        Returns:
        Prediction
      • getNumFactors

        public int getNumFactors()
        Number of factors used in this recommender.
        Returns:
        Number of factors
      • getNumIters

        public int getNumIters()
        Number of iterations used in this recommender.
        Returns:
        Number of factors
      • getGamma

        public double getGamma()
        Getter of the gamma value.
        Returns:
        Gamma value
      • getLambda

        public double getLambda()
        Getter of the Lambda value.
        Returns:
        Lambda value