Commit 72ac610ba7c10df4cd1d2b132c653c0e5f6c5862
1 parent
690cbed8
Exists in
master
and in
1 other branch
Added config option k_neighbors.
Showing
1 changed file
with
18 additions
and
6 deletions
Show diff stats
src/config.py
@@ -40,7 +40,7 @@ class Config(): | @@ -40,7 +40,7 @@ class Config(): | ||
40 | self.output = "/dev/null" | 40 | self.output = "/dev/null" |
41 | self.survey_mode = 1 | 41 | self.survey_mode = 1 |
42 | self.axi = "/var/lib/apt-xapian-index/index" | 42 | self.axi = "/var/lib/apt-xapian-index/index" |
43 | -# self.dde_url = "http://dde.debian.net/dde/q/udd/packs/all/%s?t=json" | 43 | + #self.dde_url = "http://dde.debian.net/dde/q/udd/packs/all/%s?t=json" |
44 | self.dde_url = "http://46.4.235.200:8000/q/udd/packages/all/%s?t=json" | 44 | self.dde_url = "http://46.4.235.200:8000/q/udd/packages/all/%s?t=json" |
45 | self.popcon_index = os.path.expanduser("~/.app-recommender/popcon_index") | 45 | self.popcon_index = os.path.expanduser("~/.app-recommender/popcon_index") |
46 | self.popcon_dir = os.path.expanduser("~/.app-recommender/popcon_dir") | 46 | self.popcon_dir = os.path.expanduser("~/.app-recommender/popcon_dir") |
@@ -51,6 +51,9 @@ class Config(): | @@ -51,6 +51,9 @@ class Config(): | ||
51 | self.strategy = "cb" | 51 | self.strategy = "cb" |
52 | self.weight = "bm25" | 52 | self.weight = "bm25" |
53 | self.profile_size = 50 | 53 | self.profile_size = 50 |
54 | + # options: maximal, voted, desktop | ||
55 | + self.profiling = "maximal" | ||
56 | + self.k_neighbors = 100 | ||
54 | self.load_options() | 57 | self.load_options() |
55 | self.set_logger() | 58 | self.set_logger() |
56 | 59 | ||
@@ -77,7 +80,9 @@ class Config(): | @@ -77,7 +80,9 @@ class Config(): | ||
77 | print " [ recommender ]" | 80 | print " [ recommender ]" |
78 | print " -w, --weight=OPTION Search weighting scheme" | 81 | print " -w, --weight=OPTION Search weighting scheme" |
79 | print " -s, --strategy=OPTION Recommendation strategy" | 82 | print " -s, --strategy=OPTION Recommendation strategy" |
80 | - print " -z, --profile_size=SIZE Size of user profile" | 83 | + print " -z, --profilesize=k Size of user profile" |
84 | + print " -f, --profiling=OPTION Profile filter strategy" | ||
85 | + print " -n, --neighbors=k Size of neighborhood for collaboration" | ||
81 | print "" | 86 | print "" |
82 | print " [ weight options ] " | 87 | print " [ weight options ] " |
83 | print " trad = traditional probabilistic weighting" | 88 | print " trad = traditional probabilistic weighting" |
@@ -132,12 +137,15 @@ class Config(): | @@ -132,12 +137,15 @@ class Config(): | ||
132 | self.strategy = self.read_option('recommender', 'strategy') | 137 | self.strategy = self.read_option('recommender', 'strategy') |
133 | self.profile_size = int(self.read_option('recommender', | 138 | self.profile_size = int(self.read_option('recommender', |
134 | 'profile_size')) | 139 | 'profile_size')) |
140 | + self.profiling = self.read_option('recommender', 'profiling') | ||
141 | + self.k_neighbors = int(self.read_option('recommender', | ||
142 | + 'k_neighbors')) | ||
135 | 143 | ||
136 | - short_options = "hdvo:a:e:p:m:ul:c:x:w:s:z:" | 144 | + short_options = "hdvo:a:e:p:m:ul:c:x:w:s:z:f:n:" |
137 | long_options = ["help", "debug", "verbose", "output=", | 145 | long_options = ["help", "debug", "verbose", "output=", |
138 | "axi=", "dde=", "popconindex=", "popcondir=", "indexmode=", | 146 | "axi=", "dde=", "popconindex=", "popcondir=", "indexmode=", |
139 | - "clustersdir=", "kmedoids=", "max_popcon=", "weight=", "strategy=", | ||
140 | - "profile_size="] | 147 | + "clustersdir=", "kmedoids=", "maxpopcon=", "weight=", "strategy=", |
148 | + "profile_size=", "profiling=", "neighbors="] | ||
141 | try: | 149 | try: |
142 | opts, args = getopt.getopt(sys.argv[1:], short_options, | 150 | opts, args = getopt.getopt(sys.argv[1:], short_options, |
143 | long_options) | 151 | long_options) |
@@ -178,7 +186,11 @@ class Config(): | @@ -178,7 +186,11 @@ class Config(): | ||
178 | elif o in ("-s", "--strategy"): | 186 | elif o in ("-s", "--strategy"): |
179 | self.strategy = p | 187 | self.strategy = p |
180 | elif o in ("-z", "--profile_size"): | 188 | elif o in ("-z", "--profile_size"): |
181 | - self.strategy = int(p) | 189 | + self.profile_size = int(p) |
190 | + elif o in ("-z", "--profiling"): | ||
191 | + self.profiling = p | ||
192 | + elif o in ("-n", "--neighbors"): | ||
193 | + self.k_neighbors = int(p) | ||
182 | else: | 194 | else: |
183 | assert False, "unhandled option" | 195 | assert False, "unhandled option" |
184 | 196 |