Commit c4db70ca68e5540358d672163baf5c5726673d5b

Authored by Tássia Camões Araújo
1 parent f2264959
Exists in master and in 1 other branch add_vagrant

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,7 +140,7 @@ class F1(Metric):
140 p = Precision().run(evaluation) 140 p = Precision().run(evaluation)
141 r = Recall().run(evaluation) 141 r = Recall().run(evaluation)
142 if (p+r)>0: 142 if (p+r)>0:
143 - return float((2*p*r))/(p+r) 143 + return float(2*((p*r)/(p+r)))
144 else: 144 else:
145 return 0 145 return 0
146 146
@@ -289,7 +289,7 @@ class CrossValidation: @@ -289,7 +289,7 @@ class CrossValidation:
289 result_size = int(self.recommender.items_repository.get_doccount()* 289 result_size = int(self.recommender.items_repository.get_doccount()*
290 self.result_proportion) 290 self.result_proportion)
291 predicted_result = self.recommender.get_recommendation(round_user,result_size) 291 predicted_result = self.recommender.get_recommendation(round_user,result_size)
292 - print len(round_partition) 292 + #print len(round_partition)
293 real_result = RecommendationResult(round_partition) 293 real_result = RecommendationResult(round_partition)
294 #logging.debug("Predicted result: %s",predicted_result) 294 #logging.debug("Predicted result: %s",predicted_result)
295 evaluation = Evaluation(predicted_result,real_result, 295 evaluation = Evaluation(predicted_result,real_result,