I am creating user based collaborative filtering model using GSQL. I have calculated similarity between users and stored the result in “similarity_score” attrbiute on edge “similar_customer”. Below is the sample design schema :
for those customers in test set, I need to find top 10 similar customers and then generate a recommendation score for items these top 10 neighbors have bought.
test_customers = select s from start:s-(customer_product:e)-product:t where e.test_label==True; # I know below code is incorrect, looking for a way to store top 10 similar customers with highest #similarity score. test_customers = select s from test_customers:s-(similar_customer:e)-:t ACCUM t.@similarity_score+=e.similarity_score POST-ACCUM s.@top_10_neighbors+=t, ORDER BY t.@similarity_score desc limit 10;
Could anyone please suggest an optimized way to do so?