Class GMF
- java.lang.Object
-
- es.upm.etsisi.cf4j.recommender.Recommender
-
- es.upm.etsisi.cf4j.recommender.neural.GMF
-
public class GMF extends Recommender
Implements He, X., Liao, L., Zhang, H., Nie, L., Hu, X., & Chua, T. S. (2017, April). Neural collaborative filtering. In Proceedings of the 26th international conference on world wide web (pp. 173-182).
-
-
Field Summary
Fields Modifier and Type Field Description protected doublelearningRateLearning Rateprotected intnumFactorsNumber of latent factors-
Fields inherited from class es.upm.etsisi.cf4j.recommender.Recommender
datamodel
-
-
Constructor Summary
Constructors Constructor Description GMF(DataModel datamodel, int numFactors, int numEpochs, double learningRate)Model constructorGMF(DataModel datamodel, int numFactors, int numEpochs, double learningRate, long seed)Model constructorGMF(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()Returns learning rate.intgetNumEpochs()Returns the number of epochs.intgetNumFactors()Returns the number of latent factors.doublepredict(int userIndex, int itemIndex)Returns the prediction of a rating of a certain user for a certain item, through these predictions the metrics of MAE, MSE and RMSE can be obtained.StringtoString()-
Methods inherited from class es.upm.etsisi.cf4j.recommender.Recommender
getDataModel, predict
-
-
-
-
Constructor Detail
-
GMF
public GMF(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.
- numEpochs: int value with the number of epochs.
- learningRate: double value with the learning rate.
- seed (optional): random seed for random numbers generation. If missing, random value is used.
- Parameters:
datamodel- DataModel instanceparams- Model's hyper-parameters values
-
GMF
public GMF(DataModel datamodel, int numFactors, int numEpochs, double learningRate)
Model constructor- Parameters:
datamodel- DataModel instancenumFactors- Number of factorsnumEpochs- Number of epochslearningRate- Learning rate
-
GMF
public GMF(DataModel datamodel, int numFactors, int numEpochs, double learningRate, long seed)
Model constructor- Parameters:
datamodel- DataModel instancenumFactors- Number of factorsnumEpochs- Number of epochslearningRate- Learning rateseed- Seed for random numbers generation
-
-
Method Detail
-
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)Returns the prediction of a rating of a certain user for a certain item, through these predictions the metrics of MAE, MSE and RMSE can be obtained.- 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
-
getNumEpochs
public int getNumEpochs()
Returns the number of epochs.- Returns:
- Number of epochs.
-
getNumFactors
public int getNumFactors()
Returns the number of latent factors.- Returns:
- Number of latent factors.
-
getLearningRate
public double getLearningRate()
Returns learning rate.- Returns:
- learning rate.
-
-