Commit 842edc0b742abb2d0fbaf6a38a4a79d8163a3722

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

Added metrics to cross-validation script.

Showing 1 changed file with 7 additions and 3 deletions   Show diff stats
src/examples/cross_validation.py
@@ -40,16 +40,20 @@ if __name__ == '__main__': @@ -40,16 +40,20 @@ if __name__ == '__main__':
40 try: 40 try:
41 cfg = Config() 41 cfg = Config()
42 rec = Recommender(cfg) 42 rec = Recommender(cfg)
  43 + print "\nRecommender strategy: ",rec.strategy.description
43 user = LocalSystem() 44 user = LocalSystem()
44 - user.maximal_pkg_profile()  
45 - 45 + #user.app_pkg_profile(rec.items_repository)
  46 + user.no_auto_pkg_profile()
46 begin_time = datetime.datetime.now() 47 begin_time = datetime.datetime.now()
47 logging.debug("Cross-validation started at %s" % begin_time) 48 logging.debug("Cross-validation started at %s" % begin_time)
48 49
49 metrics = [] 50 metrics = []
50 metrics.append(Precision()) 51 metrics.append(Precision())
51 metrics.append(Recall()) 52 metrics.append(Recall())
52 - validation = CrossValidation(0.3,10,rec,metrics) 53 + metrics.append(F1())
  54 + metrics.append(Accuracy())
  55 + metrics.append(SimpleAccuracy())
  56 + validation = CrossValidation(0.3,10,rec,metrics,0.005)
53 validation.run(user) 57 validation.run(user)
54 print validation 58 print validation
55 59