Commit 0d315564c0a07f491ce500700e75bb3aa93a64ad
1 parent
089fe5af
Exists in
master
and in
1 other branch
Minor changes, conformity with new options.
Showing
4 changed files
with
14 additions
and
10 deletions
Show diff stats
src/bin/apprec.py
... | ... | @@ -35,9 +35,9 @@ if __name__ == '__main__': |
35 | 35 | cfg = Config() |
36 | 36 | rec = Recommender(cfg) |
37 | 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 | 41 | user.maximal_pkg_profile() |
42 | 42 | |
43 | 43 | logging.info("Recommending applications for user %s" % user.user_id) | ... | ... |
src/bin/cross_validation.py
... | ... | @@ -29,13 +29,16 @@ import datetime |
29 | 29 | from config import Config |
30 | 30 | from evaluation import CrossValidation, Precision, Recall, F1, Accuracy, SimpleAccuracy |
31 | 31 | from recommender import Recommender |
32 | -from user import RandomPopcon | |
32 | +from user import RandomPopcon,LocalSystem,PopconSystem | |
33 | 33 | |
34 | 34 | if __name__ == '__main__': |
35 | 35 | cfg = Config() |
36 | 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 | 42 | user.maximal_pkg_profile() |
40 | 43 | begin_time = datetime.datetime.now() |
41 | 44 | |
... | ... | @@ -45,7 +48,7 @@ if __name__ == '__main__': |
45 | 48 | metrics.append(F1()) |
46 | 49 | metrics.append(Accuracy()) |
47 | 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 | 52 | validation.run(user) |
50 | 53 | print validation |
51 | 54 | ... | ... |
src/bin/get_desktop.sh
src/bin/pkgindex.py
... | ... | @@ -35,13 +35,14 @@ if __name__ == '__main__': |
35 | 35 | cfg = Config() |
36 | 36 | begin_time = datetime.datetime.now() |
37 | 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 | 39 | pkgs_list = [line.strip() for line in valid] |
40 | 40 | logging.info("Packages list length: %d" % len(pkgs_list)) |
41 | 41 | |
42 | 42 | # use config file or command line options |
43 | + pkgs_filter = cfg.pkgs_filter.lstrip(cfg.filters_dir) | |
43 | 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 | 46 | end_time = datetime.datetime.now() |
46 | 47 | logging.info("Sample package indexing completed at %s" % end_time) |
47 | 48 | logging.info("Number of documents (packages): %d" % | ... | ... |