Commit 4885b0b0dd0412225f9c0bf766b0c0eedf9c16d5
1 parent
e7a33821
Exists in
master
and in
1 other branch
Fix KnnContentEset strategy.
Showing
1 changed file
with
4 additions
and
3 deletions
Show diff stats
src/strategy.py
| ... | ... | @@ -100,6 +100,7 @@ class ContentBased(RecommendationStrategy): |
| 100 | 100 | |
| 101 | 101 | def get_sugestion_from_profile(self,rec,user,profile,recommendation_size): |
| 102 | 102 | query = xapian.Query(xapian.Query.OP_OR,profile) |
| 103 | + print query | |
| 103 | 104 | enquire = xapian.Enquire(rec.items_repository) |
| 104 | 105 | enquire.set_weighting_scheme(rec.weight) |
| 105 | 106 | enquire.set_query(query) |
| ... | ... | @@ -295,7 +296,7 @@ class KnnContent(Collaborative): |
| 295 | 296 | weights = data.tfidf_weighting(rec.users_repository,neighborhood, |
| 296 | 297 | PkgExpandDecider(user.items())) |
| 297 | 298 | profile = [w[0] for w in weights][:rec.cfg.profile_size] |
| 298 | - result = ContentBased().get_sugestion_from_profile(rec,user,profile,recommendation_size) | |
| 299 | + result = ContentBased("tag",rec.cfg.profile_size).get_sugestion_from_profile(rec,user,profile,recommendation_size) | |
| 299 | 300 | return result |
| 300 | 301 | |
| 301 | 302 | class KnnContentEset(Collaborative): |
| ... | ... | @@ -313,10 +314,10 @@ class KnnContentEset(Collaborative): |
| 313 | 314 | neighbors_rset = self.get_neighborhood_rset(user,rec) |
| 314 | 315 | enquire = self.get_enquire(rec) |
| 315 | 316 | # Retrieve relevant tags based on neighborhood profile expansion |
| 316 | - eset = enquire.get_eset(rec.cfg.profile_size,rset, | |
| 317 | + eset = enquire.get_eset(rec.cfg.profile_size,neighbors_rset, | |
| 317 | 318 | TagExpandDecider()) |
| 318 | 319 | profile = [e.term for e in eset] |
| 319 | - result = ContentBased().get_sugestion_from_profile(rec,user,profile,recommendation_size) | |
| 320 | + result = ContentBased("tag",rec.cfg.profile_size).get_sugestion_from_profile(rec,user,profile,recommendation_size) | |
| 320 | 321 | return result |
| 321 | 322 | |
| 322 | 323 | class Demographic(RecommendationStrategy): | ... | ... |