Class F1
- java.lang.Object
-
- es.upm.etsisi.cf4j.qualityMeasure.QualityMeasure
-
- es.upm.etsisi.cf4j.qualityMeasure.recommendation.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)
-
-
Field Summary
-
Fields inherited from class es.upm.etsisi.cf4j.qualityMeasure.QualityMeasure
recommender
-
-
Constructor Summary
Constructors Constructor Description F1(Recommender recommender, int numberOfRecommendations, double relevantThreshold)
ConstructorF1(Recommender recommender, Map<String,Object> params)
Constructor from a Map object with the quality measure parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected double
getScore(TestUser testUser, double[] predictions)
Computes the quality measure score for a TestUser given the predictions for his/her test ratings-
Methods inherited from class es.upm.etsisi.cf4j.qualityMeasure.QualityMeasure
getScore, getScore
-
-
-
-
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 computedparams
- 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 computednumberOfRecommendations
- Number of recommendationsrelevantThreshold
- 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 classQualityMeasure
- Parameters:
testUser
- TestUser for which the quality measure score is computedpredictions
- Prediction value for the test items rated by the test user- Returns:
- Quality measure score
-
-