Class F1


  • public class F1
    extends QualityMeasure
    This class calculates the F1 score of the recommender system. F1 score is computed as follows:

    F1 = 2 * precision * recall / (precision + recall)

    • Constructor Detail

      • F1

        public F1​(Recommender recommender,
                  Map<String,​Object> params)
        Constructor from a Map object with the quality measure parameters. Map object must contains the following keys:
        • numberOfRecommendations: int value with the number of items to be recommended.
        • relevantThreshold:: double value with the minimum rating to consider a test rating as relevant.
        Parameters:
        recommender - Recommender instance for which the F1 are going to be computed
        params - Quality measure's parameters
      • F1

        public F1​(Recommender recommender,
                  int numberOfRecommendations,
                  double relevantThreshold)
        Constructor
        Parameters:
        recommender - Recommender instance for which the F1 are going to be computed
        numberOfRecommendations - Number of recommendations
        relevantThreshold - Minimum rating to consider a rating as relevant
    • Method Detail

      • getScore

        protected double getScore​(TestUser testUser,
                                  double[] predictions)
        Description copied from class: QualityMeasure
        Computes the quality measure score for a TestUser given the predictions for his/her test ratings
        Specified by:
        getScore in class QualityMeasure
        Parameters:
        testUser - TestUser for which the quality measure score is computed
        predictions - Prediction value for the test items rated by the test user
        Returns:
        Quality measure score