Class BeMF
- java.lang.Object
-
- es.upm.etsisi.cf4j.recommender.Recommender
-
- es.upm.etsisi.cf4j.recommender.matrixFactorization.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.
-
-
Field Summary
-
Fields inherited from class es.upm.etsisi.cf4j.recommender.Recommender
datamodel
-
-
Constructor Summary
Constructors Constructor Description BeMF(DataModel datamodel, int numFactors, int numIters, double learningRate, double regularization, double[] ratings)Model constructorBeMF(DataModel datamodel, int numFactors, int numIters, double learningRate, double regularization, double[] ratings, long seed)Model constructorBeMF(DataModel datamodel, Map<String,Object> params)Model constructor from a Map containing the model's hyper-parameters values.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidfit()Estimates model parameters given the hyper-parametersdoublegetLearningRate()Get the learning rate parameter of the modelintgetNumFactors()Get the number of factors of the modelintgetNumIters()Get the number of iterationsdouble[]getRatings()Get the discrete ratings valuesdoublegetRegularization()Get the regularization parameter of the modeldoublepredict(int userIndex, int itemIndex)Computes a rating predictiondoublepredictProba(int userIndex, int itemIndex)Computes a prediction probabilityStringtoString()-
Methods inherited from class es.upm.etsisi.cf4j.recommender.Recommender
getDataModel, predict
-
-
-
-
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 instanceparams- 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 instancenumFactors- Number of latent factorsnumIters- Number of iterationslearningRate- Learning rateregularization- Regularizationratings- 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 instancenumFactors- Number of latent factorsnumIters- Number of iterationslearningRate- Learning rateregularization- Regularizationratings- Discrete ratings valuesseed- 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:RecommenderEstimates model parameters given the hyper-parameters- Specified by:
fitin classRecommender
-
predict
public double predict(int userIndex, int itemIndex)Description copied from class:RecommenderComputes a rating prediction- Specified by:
predictin classRecommender- Parameters:
userIndex- Index of the user in the array of Users of the DataModel instanceitemIndex- 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 instanceitemIndex- Index of the item in the array of Items of the DataModel instance- Returns:
- Prediction probability
-
-