Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ raccoon.recommendFor('chrisId', 10, function(results){
raccoon.config.nearestNeighbors = 5; // number of neighbors you want to compare a user against
raccoon.config.className = 'movie'; // prefix for your items (used for redis)
raccoon.config.numOfRecsStore = 30; // number of recommendations to store per user
raccoon.config.updateRatingOnInput = true; // update recommendations on each input
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Do you think it makes sense to put this in config if you're going to be toggling it multiple times during it's use. I think it belongs more as an optional parameter.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes - take a look at lib/input.js line 15.

it will rating update will trigger on each call If you not put it in config

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I PR-ed a version with each request option instead of config. - #41

raccoon.config.factorLeastSimilarLeastLiked = false; // if you want to factor in items that
// users least similar didn't like

Expand Down
1 change: 1 addition & 0 deletions lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ function Config (){
this.className = 'movie';
this.numOfRecsStore = 30;
this.factorLeastSimilarLeastLiked = false;
this.updateRatingOnInput = true;
}

module.exports = exports = new Config();
8 changes: 6 additions & 2 deletions lib/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@ var updateSequence = function(userId, itemId, callback){
});
},
function(cb){
algo.updateRecommendationsFor(userId, function(){
if (config.updateRatingOnInput) {
algo.updateRecommendationsFor(userId, function(){
cb(null);
});
} else {
cb(null);
});
};
}
],
function(err){
Expand Down
1 change: 1 addition & 0 deletions lib/raccoon.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Raccoon.prototype.config = config;
Raccoon.prototype.stat = stat;
Raccoon.prototype.liked = input.liked;
Raccoon.prototype.disliked = input.disliked;
Raccoon.prototype.updateRecommendationsFor = algo.updateRecommendationsFor;
Raccoon.prototype.recommendFor = stat.recommendFor;
Raccoon.prototype.bestRated = stat.bestRated;
Raccoon.prototype.worstRated = stat.worstRated;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "raccoon",
"author": "Guy Morita",
"description": "A Collaborative Filtering Recommendation Engine for Node.js utilizing Redis",
"version": "0.2.3",
"version": "0.2.4",
"repository": {
"type": "git",
"url": "https://github.com/guymorita/recommendationRaccoon.git"
Expand Down