Class HPF


  • public class HPF
    extends Recommender
    Implements Gopalan, P., Hofman, J. M., & Blei, D. M. (2015, July). Scalable Recommendation with Hierarchical Poisson Factorization. In UAI (pp. 326-335).
    • Field Detail

      • numFactors

        protected final int numFactors
        Number of latent factors
      • numIters

        protected final int numIters
        Number of iterations
      • a

        protected final double a
      • aPrime

        protected final double aPrime
      • bPrime

        protected final double bPrime
      • c

        protected final double c
      • cPrime

        protected final double cPrime
      • dPrime

        protected final double dPrime
      • gamma

        protected final double[][] gamma
      • gammaShp

        protected final double[][] gammaShp
      • gammaRte

        protected final double[][] gammaRte
      • kappaShp

        protected final double kappaShp
      • kappaRte

        protected final double[] kappaRte
      • lambda

        protected final double[][] lambda
      • lambdaShp

        protected final double[][] lambdaShp
      • lambdaRte

        protected final double[][] lambdaRte
      • tauShp

        protected final double tauShp
      • tauRte

        protected final double[] tauRte
    • Constructor Detail

      • HPF

        public HPF​(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.
        • a (optional): double value with the a hyper-parameter. If missing, it is set to 0.3.
        • aPrime (optional): double value with the a' hyper-parameter. If missing, it is set to 0.3.
        • bPrime (optional): double value with the b' hyper-parameter. If missing, it is set to 1.0.
        • c (optional): double value with the c hyper-parameter. If missing, it is set to 0.3.
        • cPrime (optional): double value with the c' hyper-parameter. If missing, it is set to 0.3.
        • dPrime (optional): double value with the d' hyper-parameter. If missing, it is set to 1.0.
        • seed (optional): random seed for random numbers generation. If missing, random value is used.
        Parameters:
        datamodel - DataModel instance
        params - Model's hyper-parameters values
      • HPF

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

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

        public HPF​(DataModel datamodel,
                   int numFactors,
                   int numIters,
                   double a,
                   double aPrime,
                   double bPrime,
                   double c,
                   double cPrime,
                   double dPrime)
        Models constructor
        Parameters:
        datamodel - DataModel instance
        numFactors - Number of latent factors
        numIters - Number of iterations
        a - Model hyper-parameter. Read the paper for more information related to this hyper-parameter.
        aPrime - Model hyper-parameter. Read the paper for more information related to this hyper-parameter.
        bPrime - Model hyper-parameter. Read the paper for more information related to this hyper-parameter.
        c - Model hyper-parameter. Read the paper for more information related to this hyper-parameter.
        cPrime - Model hyper-parameter. Read the paper for more information related to this hyper-parameter.
        dPrime - Model hyper-parameter. Read the paper for more information related to this hyper-parameter.
      • HPF

        public HPF​(DataModel datamodel,
                   int numFactors,
                   int numIters,
                   double a,
                   double aPrime,
                   double bPrime,
                   double c,
                   double cPrime,
                   double dPrime,
                   long seed)
        Models constructor
        Parameters:
        datamodel - DataModel instance
        numFactors - Number of latent factors
        numIters - Number of iterations
        a - Model hyper-parameter. Read the paper for more information related to this hyper-parameter.
        aPrime - Model hyper-parameter. Read the paper for more information related to this hyper-parameter.
        bPrime - Model hyper-parameter. Read the paper for more information related to this hyper-parameter.
        c - Model hyper-parameter. Read the paper for more information related to this hyper-parameter.
        cPrime - Model hyper-parameter. Read the paper for more information related to this hyper-parameter.
        dPrime - Model hyper-parameter. Read the paper for more information related to this 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()
        Get the number of factors of the model
        Returns:
        Number of factors
      • getNumIters

        public int getNumIters()
        Get the number of iterations
        Returns:
        Number of iterations