Commit 0d315564c0a07f491ce500700e75bb3aa93a64ad

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

Minor changes, conformity with new options.

src/bin/apprec.py
@@ -35,9 +35,9 @@ if __name__ == '__main__': @@ -35,9 +35,9 @@ if __name__ == '__main__':
35 cfg = Config() 35 cfg = Config()
36 rec = Recommender(cfg) 36 rec = Recommender(cfg)
37 logging.info("Computation started at %s" % begin_time) 37 logging.info("Computation started at %s" % begin_time)
38 - user = RandomPopcon(cfg.popcon_dir,os.path.join(cfg.filters,"desktop"))  
39 - #user = LocalSystem()  
40 - user.filter_pkg_profile(os.path.join(cfg.filters,"desktop")) 38 + #user = RandomPopcon(cfg.popcon_dir,os.path.join(cfg.filters_dir,"desktopapps"))
  39 + user = LocalSystem()
  40 + user.filter_pkg_profile(os.path.join(cfg.filters_dir,"desktopapps"))
41 user.maximal_pkg_profile() 41 user.maximal_pkg_profile()
42 42
43 logging.info("Recommending applications for user %s" % user.user_id) 43 logging.info("Recommending applications for user %s" % user.user_id)
src/bin/cross_validation.py
@@ -29,13 +29,16 @@ import datetime @@ -29,13 +29,16 @@ import datetime
29 from config import Config 29 from config import Config
30 from evaluation import CrossValidation, Precision, Recall, F1, Accuracy, SimpleAccuracy 30 from evaluation import CrossValidation, Precision, Recall, F1, Accuracy, SimpleAccuracy
31 from recommender import Recommender 31 from recommender import Recommender
32 -from user import RandomPopcon 32 +from user import RandomPopcon,LocalSystem,PopconSystem
33 33
34 if __name__ == '__main__': 34 if __name__ == '__main__':
35 cfg = Config() 35 cfg = Config()
36 rec = Recommender(cfg) 36 rec = Recommender(cfg)
37 - user = RandomPopcon(cfg.popcon_dir,os.path.join(cfg.filters,"desktop"))  
38 - user.filter_pkg_profile(os.path.join(cfg.filters,"desktop")) 37 + #user = LocalSystem()
  38 + #user = RandomPopcon(cfg.popcon_dir)
  39 + #user = RandomPopcon(cfg.popcon_dir,os.path.join(cfg.filters_dir,"desktopapps"))
  40 + user = PopconSystem("/home/tassia/.app-recommender/popcon-entries/4a/4a67a295ec14826db2aa1d90be2f1623")
  41 + user.filter_pkg_profile(os.path.join(cfg.filters_dir,"desktopapps"))
39 user.maximal_pkg_profile() 42 user.maximal_pkg_profile()
40 begin_time = datetime.datetime.now() 43 begin_time = datetime.datetime.now()
41 44
@@ -45,7 +48,7 @@ if __name__ == '__main__': @@ -45,7 +48,7 @@ if __name__ == '__main__':
45 metrics.append(F1()) 48 metrics.append(F1())
46 metrics.append(Accuracy()) 49 metrics.append(Accuracy())
47 metrics.append(SimpleAccuracy()) 50 metrics.append(SimpleAccuracy())
48 - validation = CrossValidation(0.9,10,rec,metrics,0.01) 51 + validation = CrossValidation(0.9,10,rec,metrics,0.005)
49 validation.run(user) 52 validation.run(user)
50 print validation 53 print validation
51 54
src/bin/get_desktop.sh
@@ -3,4 +3,4 @@ @@ -3,4 +3,4 @@
3 # get_desktop.sh - get packages which have desktop files 3 # get_desktop.sh - get packages which have desktop files
4 4
5 cd /usr/share/app-install/desktop 5 cd /usr/share/app-install/desktop
6 -sed -ne 's/X-AppInstall-Package=//p' * | sort -u 6 +sed -ne 's/X-AppInstall-Package=//p' * | sort -u | grep -v kdelibs | grep -v libfm-gtk0
src/bin/pkgindex.py
@@ -35,13 +35,14 @@ if __name__ == '__main__': @@ -35,13 +35,14 @@ if __name__ == '__main__':
35 cfg = Config() 35 cfg = Config()
36 begin_time = datetime.datetime.now() 36 begin_time = datetime.datetime.now()
37 logging.info("Sample package indexing started at %s" % begin_time) 37 logging.info("Sample package indexing started at %s" % begin_time)
38 - with open(os.path.join(cfg.filters,cfg.pkgs_filter)) as valid: 38 + with open(cfg.pkgs_filter) as valid:
39 pkgs_list = [line.strip() for line in valid] 39 pkgs_list = [line.strip() for line in valid]
40 logging.info("Packages list length: %d" % len(pkgs_list)) 40 logging.info("Packages list length: %d" % len(pkgs_list))
41 41
42 # use config file or command line options 42 # use config file or command line options
  43 + pkgs_filter = cfg.pkgs_filter.lstrip(cfg.filters_dir)
43 pkgindex = data.SampleAptXapianIndex(pkgs_list,xapian.Database(cfg.axi), 44 pkgindex = data.SampleAptXapianIndex(pkgs_list,xapian.Database(cfg.axi),
44 - cfg.axi+"-"+cfg.pkgs_filter) 45 + os.path.join(cfg.base_dir,"axi_"+pkgs_filter))
45 end_time = datetime.datetime.now() 46 end_time = datetime.datetime.now()
46 logging.info("Sample package indexing completed at %s" % end_time) 47 logging.info("Sample package indexing completed at %s" % end_time)
47 logging.info("Number of documents (packages): %d" % 48 logging.info("Number of documents (packages): %d" %