I have a chart using NEO4j and currently trying to create a simple recommendation system that is better than text based search.
Nodes are created, such as: Album, People, Type, Chart
Relationships are created, such as:
People - [:role] -> Album where roles: Artist, Producer, Composer
Album-[:is_a_type_of]->Type (type mainly Pop, Rock, Disco ...)
People -[:POPULAR_ON]->Chart (A chart is a billboard they might be)
People -[:SIMILAR_TO]->People (specified similarity connection)
I wrote the following cypher:
MATCH (a:Album { id: { id } })-[:is_a_type_of]->(t)<-[:is_a_type_of]-(recommend) WITH recommend, t, a MATCH (recommend)<-[:ARTIST_OF]-(p) OPTIONAL MATCH (p)-[:POPULAR_ON]->() RETURN recommend, count(DISTINCT t) AS type ORDER BY type DESC LIMIT 25;
It works, however, it is easy to repeat if it has only one type of music associated with it, so it has the same neighbors.
Is there any way to say:
- Find me the next best album that has the most similar relationship with the original album.
- Any recommendation for a tiebreak scenario? Now this is an order by type (so if an album has more than one type of music, it is valued more, but if each has the same number, it no longer matters)
- -I made a link [: SIMILAR_TO] to provide priority to consider this relationship important, but I did not have a working cypher with it.
- -Changed for [: Popular_On] (Maybe Drop this relationship?)
source share