Class BeMF


  • public class BeMF
    extends Recommender
    Implements Ortega, F., Lara-Cabrera, R., González-Prieto, Á., & Bobadilla, J. (2021). Providing reliability in recommender systems through Bernoulli matrix factorization. Information Sciences, 553, 110-128.
    • Constructor Detail

      • BeMF

        public BeMF​(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.
        • learningRate: double value with the learning rate hyper-parameter.
        • regularization: double value with the regularization hyper-parameter.
        • ratings: discrete ratings values.
        • seed (optional): random seed for random numbers generation. If missing, random value is used.
        Parameters:
        datamodel - DataModel instance
        params - Model's hyper-parameters values
      • BeMF

        public BeMF​(DataModel datamodel,
                    int numFactors,
                    int numIters,
                    double learningRate,
                    double regularization,
                    double[] ratings)
        Model constructor
        Parameters:
        datamodel - DataModel instance
        numFactors - Number of latent factors
        numIters - Number of iterations
        learningRate - Learning rate
        regularization - Regularization
        ratings - Discrete ratings values
      • BeMF

        public BeMF​(DataModel datamodel,
                    int numFactors,
                    int numIters,
                    double learningRate,
                    double regularization,
                    double[] ratings,
                    long seed)
        Model constructor
        Parameters:
        datamodel - DataModel instance
        numFactors - Number of latent factors
        numIters - Number of iterations
        learningRate - Learning rate
        regularization - Regularization
        ratings - Discrete ratings values
        seed - Seed for random numbers generation
    • Method Detail

      • 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
      • getLearningRate

        public double getLearningRate()
        Get the learning rate parameter of the model
        Returns:
        Learning rate
      • getRegularization

        public double getRegularization()
        Get the regularization parameter of the model
        Returns:
        Regularization
      • getRatings

        public double[] getRatings()
        Get the discrete ratings values
        Returns:
        Discrete ratings values
      • 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
      • predictProba

        public double predictProba​(int userIndex,
                                   int itemIndex)
        Computes a prediction probability
        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 probability