Git Product home page Git Product logo

guymorita / recommendationraccoon Goto Github PK

View Code? Open in Web Editor NEW
809.0 809.0 131.0 124 KB

A collaborative filtering based recommendation engine and NPM module built on top of Node.js and Redis. The engine uses the Jaccard coefficient to determine the similarity between users and k-nearest-neighbors to create recommendations. This module is useful for anyone with a database of users, a database of products/movies/items and the desire to give their users the ability to like/dislike and receive recommendations.

License: MIT License

JavaScript 100.00%

recommendationraccoon's People

Contributors

guymorita avatar kostyukdg avatar miguelgimenezgimenez avatar olekenneth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

recommendationraccoon's Issues

Cannot change a rating once added

  • disliking something you liked doesn't remove it from the liked list.
  • liking something you disliked doesn't remove it from the disliked list.
  • and there's no way to remove a rating.

How is this module even supposed to be used? Am I supposed to re-make the whole redis database every time I want to change it? Because that defeats the point of using redis for its speed...

updateRecommendations should be optional

Let's say I added 20 items in loop call. The system is re-calculate rating on each addition.

Should be available option to update ration only after all items has been added.

is there a method to flush() just the configured className keys?

Since flush() it's just a shortcut to FLUSHDB, and raccoon accepts a .config.className to prefix its keys, it would be great to have a method for removing only those keys, without actually flushing the full db.

Use cases include multiple executions of raccoon (with different classNames each), and multiple executions of the same configuration (ensuring removal of previous runs). Also, being able to use an existing redis instance holding other information besides raccoon keys.

Seems easy to do, but I'd like to have your input too, also to take into account any plans to integrate other DB technologies, etc.

Hangs

When running the sample:

var raccoon = require('raccoon');

raccoon.liked('garyId', 'movieId').then(() => {
  return raccoon.liked('garyId', 'movie2Id');  
}).then(() => {
  return raccoon.liked('chrisId', 'movieId');  
}).then(() => {
  return raccoon.recommendFor('chrisId', 10);
}).then((recs) => {
  console.log('recs', recs);
  // results will be an array of x ranked recommendations for chris
  // in this case it would contain movie2
});
node racoon.js

the script never finishes, any ideas?

node version: 7.2.0 on OSx

Recos based only on own likes/dislikes?

I understood that Racoon takes into account what other users liked when giving recos. Is it possible though to only give recommendations based on what the current user liked, without taking into consideration what other users liked/disliked?

Should not recommend liked items

Great looking library! I'd like to use it but it seems that recommendations should exclude liked/disliked items. Here's an example that shows that liked items can be given as recommendations.

Steps to reproduce:

Setup:

$ git clone https://github.com/curious-attempt-bunny/node-go-lecture-recommendations.git
$ cd node-go-lecture-recommendations
$ npm install

Execute:

$ node readLectures.js | grep -B 1 "Value Of"
ChristianB liked Typical mistakes by Young Sun Yoon 8p - 4
ChristianB liked Value Of Stones lecture 7

malbery liked Typical mistakes by Young Sun Yoon 8p - 4
malbery liked Value Of Stones lecture 1
malbery liked Value Of Stones lecture 2
malbery liked Value Of Stones lecture 3
malbery liked Value Of Stones lecture 4
malbery liked Value Of Stones lecture 7

Recommendations for malbery:
[ 'Value Of Stones lecture 7',

I hope this helps,
Merlyn

How to unlike/undislike

Hi,

My site has like/dislike functions, it works with raccoon well.

However, user can unlike/undislike (undo everything as if no like/dislike before), how can I do that?

ES6 support

The latest version throws an error for ES6. Older versions work.
Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode

Neglected Library

Anyone interested in joining me in creating a new organization to house this npm module and be more active?

npm install breaks?

Trying to setup the repo locally after cloning and npm install breaks using node 0.12.8 and 4.1.1? Can anyone else reproduce this locally?

Same namespace used for both users and items

I just noticed this, and it's surprising that nobody pointed it out before.
This can create some conflicts, especially if numbers are used for user & item IDs.

I will attempt to fix it myself in my existing PR.
Edit: done. #41

Engine without Redis

I am using parse cloud code , which is not a node env .. so I cannot import modules. I tried putting everything by myself but I cant import redis as well. Is there a way to use the engine without redis ?

Modern Alternative?

Seeing as this project doesn't seem to be maintained anymore is there a modern alternative or a fork that's reasonable?

Nothing returned, crashes application with OOM error.

I have a simple route which I'd like to return recommendations. When accessing this route, .recommendFor() never returns and after a bit the application will crash with a JavaScript heap out of memory error.

I assume this might be due to the size of the redis store. Is there a limit?

I noticed when I used only a few thousand items in the store that the function would at least return however it is always an empty array.

What exactly might be the issue here?

Some code:

raccoon.recommendFor(subtopic, 5).then((recs) => {
    console.dir(recs)
})

recommendedFor empty array with remote connection

Same thing happened to me, I simply put code in my test that was displayed in the example. I logged into my redis server and made sure that the keys do exist. Here is the code i have.

NOTE: I'm connecting to a docker container by the docker machine ip address so its a remote connection

var expect = require('chai').expect;
var raccoon = require('raccoon');
raccoon.connect(6379, '192.168.99.100');

describe('this doesnt work', function() {

  before(function(done) {
    raccoon.flush();
    done();
  });

  before(function(done) {
    raccoon.liked('garyId', 'movieId');
    raccoon.liked('garyId', 'movie2Id');
    raccoon.liked('chrisId', 'movieId');
    done();
  });

  it('should show movie2', function(done) {
    raccoon.recommendFor('chrisId', 10, function(results) {
      console.log(results, 'results'); // empty array returned
      expect(true).to.eq(false);
      done();
    })
  });
})

JavaScript heap out of memory

I have a database of 127k entries, each corresponding to a userId and a movieId. I want to add these to raccoon with the raccoon.liked() method when I start my server, but doing that seems to hit the memory limit real fast. Is that normal? The .csv version of this data is not even 10 MB. What sort of data structure is being used in the implementation that it allocates around 1.5 GB for just 100 entries, hitting the memory limit?

Raccoon returns advises only for last set

lib/algorithms.js line 176

            client.sunionstore(tempSet, set, function(err){
              callback();
            });

suinonstore overrides tempSet on each call instead of appending new items.

RACCOON for bill in website

client.zrevrange(similaritySet, 0, config.nearestNeighbors -1, function(err, mostSimilarUserIds){
// returns an array of the users that are least simimilar within k nearest neighbors
client.zrange(similaritySet, 0, config.nearestNeighbors -1, function(err, leastSimilarUserIds){
// iterate through the user ids to create the redis keys for all those users likes
_.each(mostSimilarUserIds, function(id, key){
setsToUnion.push([config.className,id,'liked'].join(":"));
});
// if you want to factor in the least similar least likes, you change this in config
// left it off because it was recommending items that every disliked universally
if (config.factorLeastSimilarLeastLiked){
_.each(leastSimilarUserIds, function(id, key){
setsToUnion.push([config.className,id,'disliked'].join(":"));
});
}
...
how it finds the nearest neighbor? and recommendedSet?
With k=1 it get biggest value in similaritySet
but k=3 and k=5 is not true
i changed finalJaccardScore = 1.0*(similarity / ratedInCommon)
I use RC cho web and use "for" to add more products in the bill
var oid = req.query.oid;
var ids = req.query.ids;
if (!oid || !ids){
//tra ve loi o day
returnData(res,"ERROR");
}
var uid = toUI(oid);
var arr = ids.split(",");
var c = 0;
var id = "";
var max = arr.length;
for(var i=0;i<max;i++) {
id = arr[i];
raccoon.liked(uid, id, function(results){
c++;//tan dem
if (c == max){//neu la finish cuoi cung
returnData(res,{status:"OK", msg:"Added UID = " + uid + ", ids = " + ids});
}
});
}
is it right?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.