54
and the Future of Search GraphAware ® graphaware.com @graph_aware Real-Time Recommendations Michal Bachman

Real-Time Recommendations and the Future of Search

Embed Size (px)

Citation preview

and the Future of Search

GraphAware®

graphaware.com

@graph_aware

Real-Time Recommendations

Michal Bachman

News you should readBooks you should buyPeople you may knowPeople you should datePeople you should market a product to…

Recommendation Engines

GraphAware®

Clinical Trial MatchingLaw EnforcementEvent PlanningCareer Planning…

Recommendation Engines

GraphAware®

Content-based (features)Collaborative filtering (user <—> item relationships)

Recommendation Engines

GraphAware®

Features as well as relationships can be naturally represented as a graph.

Good News

GraphAware®

Example

IS_OF_GENRE

title: “Love Actually”

Movie

name: “Bob”

User

name: “Comedy”

Genre

RATEDrating: 5

name: “Alice”

Username:

“Romance”

Genre

title: “American Pie”

Movie

IS_OF_GENRE

IS_OF_GENRE

RATEDrating: 5

INTERESTED_IN

rating: 5RATED

GraphAware®

Traditional Approach

GraphAware®

Global viewPre-computed (analytical)

Traditional Approach

GraphAware®

Bad Recommendation

GraphAware®

Bad Recommendation

GraphAware®

Global viewPre-computed (analytical)Lacks transparencyInflexibleLacks context

Traditional Approach

GraphAware®

Local viewReal-time (query)

Graph Approach

GraphAware®

InfoJobs

GraphAware®

Recommendation logic can be expressed as graph traversals.

Graph Approach

GraphAware®

Local viewReal-time (query)FlexibleTransparentContextual

Graph Approach

GraphAware®

Cypher Query Example

MATCH (u:User {id:1})-[:LIKED]->(m:Movie), (m)<-[:LIKED]-(another:User), (another)-[:LIKED]->(reco:Movie)

WHERE NOT (u)-[:LIKED|DISLIKED]->(reco)

RETURN reco;

GraphAware®

Requirements of real-world recommendation engines are often much more complex.

The Reality

GraphAware®

Imagine you’re building the ”people you may know” feature on LinkedIn.

Example

GraphAware®

After a brainstorming session, your team came up with the following ways of finding people one may know:

Example

GraphAware®

Common contactsFacebook friends in commonEmail / mobile contacts in commonEach others email / mobile contactWorked for the same companyStudied at the same schoolShare the same interestLive in the same city

People You May Know

GraphAware®

But that’s just the beginning! Let’s go back and re-visit.

Example

GraphAware®

More contacts in common = better chance?Same city / school / company = does size matter?What about emails that don’t represent a person?What about people already connected? And pending… And rejected…And repeatedly ignored…

People You May Know

GraphAware®

Recommendation Engines

GraphAware®

DiscoverScoreRemove irrelevantMeasure quality

Recommendation Engines

GraphAware®

DiscoverScoreRemove irrelevantMeasure quality

Recommendation Engines

GraphAware®

Discover

GraphAware®

IS_OF_GENRE

title: “Love Actually”

Movie

name: “Bob”

User

name: “Comedy”

Genre

RATEDrating: 5

name: “Alice”

Username:

“Romance”

Genre

title: “American Pie”

Movie

IS_OF_GENRE

IS_OF_GENRE

RATEDrating: 5

INTERESTED_IN

rating: 5RATED

DiscoverScoreRemove irrelevantMeasure quality

Recommendation Engines

GraphAware®

Score

GraphAware®

IS_OF_GENRE

title: “Love Actually”

Movie

name: “Bob”

User

name: “Comedy”

Genre

RATEDrating: 5

name: “Alice”

Username:

“Romance”

Genre

title: “American Pie”

Movie

IS_OF_GENRE

IS_OF_GENRE

RATEDrating: 5

INTERESTED_IN

rating: 5RATED

Score

GraphAware®

Score

GraphAware®

LIVES_INMichalage:31

London Danielaage:25

LIVES_IN

DiscoverScoreRemove irrelevantMeasure quality

Recommendation Engines

GraphAware®

BlacklistFilter

Remove Irrelevant

GraphAware®

Remove Irrelevant

GraphAware®

IS_OF_GENRE

title: “Love Actually”

Movie

name: “Bob”

User

name: “Comedy”

Genre

RATEDrating: 5

name: “Alice”

Username:

“Romance”

Genre

title: “American Pie”

Movie

IS_OF_GENRE

IS_OF_GENRE

RATEDrating: 5

INTERESTED_IN

rating: 5RATED

DiscoverScoreRemove irrelevantMeasure quality

Recommendation Engines

GraphAware®

Measure Quality

GraphAware®

Recommendation: 33812631-079d-11e5 Input: 323423 Output: 99338 FriendsInCommon: 0.75 (raw value: 4) SkillsInCommon: 0.50 SameLocation: 1.00 AgeDifference: -0.25 Total: 2.00 Outcome: 1

GraphAware Reco is an open-source recommendation engine skeleton.

You Can Do It Too

GraphAware®

public class PeopleYouMayKnow extends Neo4jTopLevelDelegatingRecommendationEngine { @Override protected List<RecommendationEngine<Node, Node>> engines() { return Arrays.<RecommendationEngine<Node, Node>>asList( new SharedEmployment(), new ConnectionsInCommon(), new MobileContacts(), new ReverseMobileContacts(), new MobileContactsInCommon(), new SharedStudies() ); } @Override protected List<PostProcessor<Node, Node>> postProcessors() { return Arrays.<PostProcessor<Node, Node>>asList( new RewardSameCity(), new RewardSameState(), new PenalizeAlreadySeen() ); } @Override protected List<BlacklistBuilder<Node, Node>> blacklistBuilders() { return Arrays.asList( new ExcludeSelf(), new ExistingRelationshipBlacklistBuilder(CONNECTED, BOTH), new ExistingRelationshipBlacklistBuilder(INVITED, OUTGOING), new ExistingRelationshipBlacklistBuilder(REJECTED, BOTH) ); } @Override protected List<Filter<Node, Node>> filters() { return Arrays.<Filter<Node, Node>>asList( new PrivacySettingTooHigh() ); }}

GraphAware®

plugin to Neo4j (uses GraphAware Framework)you can use Cypher or a JVM-languageopinionated architecturevery fastvery flexiblehandles all the plumbing

GraphAware Reco

GraphAware®

GraphAware®

What’s Next?

LinkedIn

GraphAware®

Has indexingIt’s getting betterThere are more powerful tools

Neo4j

GraphAware®

Closer users on topProducts likely to buy on top…

Requirements

GraphAware®

=> Recommendation Engine with a constrained set of possible recommendations

DiscoverScoreRemove irrelevantMeasure quality

Recommendation Engines

GraphAware®

Example

IS_OF_GENRE

title: “Love Actually”

Movie

name: “Bob”

User

name: “Comedy”

Genre

RATEDrating: 5

name: “Alice”

Username:

“Romance”

Genre

title: “American Pie”

Movie

IS_OF_GENRE

IS_OF_GENRE

RATEDrating: 5

INTERESTED_IN

rating: 5RATED

GraphAware®

Graph-Aided Search

GraphAware®

Process of finding the most relevant results of a search query by combining the relevancy scores produced by a search engine with those produced by a graph-based recommendation engine.

Graph-Aided Search

GraphAware®

Graph-Aided Search

GraphAware®

Application

Write

Replicate(async)

OK

Graph-Aided Search

GraphAware®

Application

Results

Boost

Scores

Search

Graph-Aided Search

GraphAware®

Application

Write

Replicate(async)

ResultsBoostOK

Scores

Search

Recommendation Engine

Neo4j to Elasticsearch Elasticsearch to Neo4j

GraphAware®

GraphUnit& RestTest

UUID WarmUp Auditing Importer

GraphAware Framework

GraphAware®

Reco EngineElasticsearch Integration

TimeTree Algorithms NodeRank

Open Source (GPL)ActiveProduction ReadyGithub: github.com/graphaware

Our Web: graphaware.com

Maven Central

GraphAware Framework

GraphAware®

Try itGive us feedbackContributeBuild your own modulesGet in touch for support / consultancy

GraphAware Framework

GraphAware®

GraphAware®

www.graphaware.com@graph_aware

GraphAwarethe world’s #1 Neo4j consultancy