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 double
learningRate
Learning Rateprotected int
numFactors
Number 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 void
fit()
Estimates model parameters given the hyper-parametersdouble
getLearningRate()
Returns learning rate.int
getNumEpochs()
Returns the number of epochs.int
getNumFactors()
Returns the number of latent factors.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.String
toString()
-
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:Recommender
Estimates model parameters given the hyper-parameters- Specified by:
fit
in 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:
predict
in 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.
-
-