Class 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 Detail

      • numFactors

        protected final int numFactors
        Number of latent factors
      • learningRate

        protected final double learningRate
        Learning Rate
    • 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 instance
        params - Model's hyper-parameters values
      • GMF

        public GMF​(DataModel datamodel,
                   int numFactors,
                   int numEpochs,
                   double learningRate)
        Model constructor
        Parameters:
        datamodel - DataModel instance
        numFactors - Number of factors
        numEpochs - Number of epochs
        learningRate - Learning rate
      • GMF

        public GMF​(DataModel datamodel,
                   int numFactors,
                   int numEpochs,
                   double learningRate,
                   long seed)
        Model constructor
        Parameters:
        datamodel - DataModel instance
        numFactors - Number of factors
        numEpochs - Number of epochs
        learningRate - Learning rate
        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)
        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 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
      • 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.