Commit c4db70ca68e5540358d672163baf5c5726673d5b
1 parent
f2264959
Exists in
master
and in
1 other branch
Fixed F1 calculation bug
Showing
1 changed file
with
2 additions
and
2 deletions
Show diff stats
src/evaluation.py
| ... | ... | @@ -140,7 +140,7 @@ class F1(Metric): |
| 140 | 140 | p = Precision().run(evaluation) |
| 141 | 141 | r = Recall().run(evaluation) |
| 142 | 142 | if (p+r)>0: |
| 143 | - return float((2*p*r))/(p+r) | |
| 143 | + return float(2*((p*r)/(p+r))) | |
| 144 | 144 | else: |
| 145 | 145 | return 0 |
| 146 | 146 | |
| ... | ... | @@ -289,7 +289,7 @@ class CrossValidation: |
| 289 | 289 | result_size = int(self.recommender.items_repository.get_doccount()* |
| 290 | 290 | self.result_proportion) |
| 291 | 291 | predicted_result = self.recommender.get_recommendation(round_user,result_size) |
| 292 | - print len(round_partition) | |
| 292 | + #print len(round_partition) | |
| 293 | 293 | real_result = RecommendationResult(round_partition) |
| 294 | 294 | #logging.debug("Predicted result: %s",predicted_result) |
| 295 | 295 | evaluation = Evaluation(predicted_result,real_result, | ... | ... |