Question About Collaborative Filtering Query


(Tom Lancaster) #1

Hello community, I'm new to Neo4j and graph databases, and struggling with a query for a collaborative filter recommender.

I'm imagining myself as a hiring manager trying to find freelancers I don't know who have been liked by other hiring managers that have (some proportion / number of) similar likes to me.

So far I have
MATCH (fl:Person)<-[:LIKED]-(oh:Person), (oh)-[:LIKED]->(mfl:Person)<-[:LIKED]-(p:Person) WHERE oh.userId = 6562 RETURN fl - which is not returning anything.

Can anyone see where I'm going wrong?

Many thanks for any advice.

Tom


(12kunal34) #2

Hi Tom,

could you please share your data modal ,it would help us to understand your query
is there any criteria or properties for freelancer ??


(Tom Lancaster) #3

Hi, a freelancer is just a Person who is hired and liked by other Persons. Person has attribute userID among others.


(Ameyasoft) #4

Hi,

Your userid is an integer or string? See if you get any result with this query:

if integer:
MATCH (oh:Person)-[:LIKED]->(fl:Person)
WHERE oh.useid = 6562
RETURN oh, fl;

If string:

MATCH (oh:Person)-[:LIKED]->(fl:Person)
WHERE oh.useid = "6562"
RETURN oh, fl;

Check to see if any one of the above quries show result.
-Kamal


(Michael Hunger) #5

I think you got the order wrong.
If oh is your start user (yourself).

// find peer group (p)
MATCH (oh)-[:LIKED]->(mfl:Person)<-[:LIKED]-(p:Person) 
WHERE oh.userId = 6562 
// find freelancers that our peers liked
MATCH (fl:Person)<-[:LIKED]-(p:Person)
// exclude already known
WHERE not (oh)-[:LIKED]->(fl)
RETURN fl, count(*) order by count(*) desc