graphaware / neo4j-reco

Neo4j-based recommendation engine module with real-time and pre-computed recommendations.
374 stars 77 forks source link

Relate Recommendations to different Types #2

Closed joshuacano closed 9 years ago

joshuacano commented 9 years ago

Hello, I was wondering if it was possible or I could get a brief explanation of how to use the Recommendation Engine to relate two different Types of Nodes, for instance rather than match Person to Person (as in the example), we could match person to City, or Customers to items...etc. I believe I have a semi-understanding of how to do this within the Engines by Using different NodeEntities and referring to those when creating my engines. However, I was wondering if this is possible in the pre-compute step as well? Currently, the configuration file only specifies the node Label for which to make recommendations, I'm assuming this will only make recommendations to other nodes that match that same label? Unclear on exactly how to do this, just wanted to clear this up. Thanks for your help!

bachmanm commented 9 years ago

As far as the recommendation engine is concerned, an input (e.g. the person we're recommending something to, or the item we're finding customers for) is just a Node. Similarly, the actual recommendations are just Nodes, so they could be people, items, whatever. It is entirely up to you to build engines that return the right type of node.

If you're trying to build something that recommends, say, people (as output) based on either city or item, the I think you should build 2 separate top-level recommendation engines, one for each type of input.

I hope that helps.

joshuacano commented 9 years ago

I see, that definitely helps me to my next steps. Thanks for the insight Michael!

joshuacano commented 9 years ago

One last question Michael, really what I want to be doing is taking the output from a recommendation engine and feeding it to another recommendation engine and using that as the final output.

I.e Lets say we have the Person Lives_in City and Friends_of Person Example. And then we add a Eats_At Restaurant node, so I'd like to find all the recommended new friends. and then of those recommended Friends, run it through another engine and return the recommended restaurants. And so on and so forth down the line. (What dishes to recommend at these restaurants, what ingredients to recommend in these dishes...etc) Is this possible in this model?

bachmanm commented 9 years ago

I'm afraid this is a slightly different model from the one we employed in this library. I would do what you're trying to in the following way:

Each recommendation engine recommends things of a single "type" for input of a single "type". So in your example, if I'm trying to recommend restaurants to people based on where their friends are eating, I would create:

RestaurantRecommendationEngine // top-level
    FriendsFavouritePlaces // one engine that uses a traversal to find restaurants that friends go to
    FoFFavouritePlaces // another one that finds restaurants the FoFs go to
    RewardSameLocation //potentially increase the score if the restaurant is where the user lives

Then I would create an entirely different top-level engine for recommending food: input: user, restaurant output: dishes

Hope that sheds a bit of light...