Class Recommender

  • Direct Known Subclasses:
    BeMF, BiasedMF, BNMF, CLiMF, DeepMF, DirMF, GMF, HPF, ItemKNN, MLP, NCCF, NeuMF, NMF, PMF, SVDPlusPlus, URP, UserKNN

    public abstract class Recommender
    extends Object
    Abstract class that represents any recommender. To build a new recommender following methods must be implemented:
    • fit(): fits the recommender according to an instance of a DataModel.
    • predict(userIndex, itemIndex): computes a rating prediction for a given user and item.
    • Field Detail

      • datamodel

        protected DataModel datamodel
        DataModel instance used for the Recommender
    • Constructor Detail

      • Recommender

        protected Recommender​(DataModel datamodel)
        Recommender constructor
        Parameters:
        datamodel - instance of a DataModel
    • Method Detail

      • getDataModel

        public DataModel getDataModel()
        Returns the DataModel instance
        Returns:
        DataModel instance used by the Recommender
      • fit

        public abstract void fit()
        Estimates model parameters given the hyper-parameters
      • predict

        public abstract double predict​(int userIndex,
                                       int itemIndex)
        Computes a rating prediction
        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
      • predict

        public double[] predict​(TestUser testUser)
        Computes the rating predictions of the TestItems rated by a TestUser
        Parameters:
        testUser - TestUser for which to calculate resting predictions
        Returns:
        Rating prediction for TestItems rated by testUser. Positions of this array overlaps with testItemIndexes returned by testUser.getTestItemAt(pos)