Im trying to find similar images using approximate nearest neighbour algorithm using cosine similarity. This is the query:
MATCH (p:Image)
WITH {item:id(p), weights: p.vec} AS userData
WITH collect(userData) AS data
CALL gds.alpha.ml.ann.write({
nodeProjection: '',
relationshipProjection: '',
data: data,
topK:20,
algorithm: 'cosine',
writeRelationshipType:"SIMILAR_APPROX",
similarityCutoff: 0.1,
p:0.5,
maxIterations:50
})
YIELD nodes, similarityPairs, computations
RETURN nodes,
apoc.number.format(similarityPairs) AS similarityPairs,
apoc.number.format(computations) AS computations
But when I search similar images to one specific image, non of the results are from the same category as the first image (dolphin). I have 9119 nodes in my database. Here's the query for searching similar images to one specific image:
MATCH (r:Image) WHERE id(r)=1932
WITH r,
[(r)-[:SIMILAR_APPROX]->(i)| i.path ] AS similarNodes
RETURN similarNodes
input image:
one example of output images:
Am I missing some parameters in algorithm or why am I getting results from other categories when clearly I have more similar images in database?
Thank you in advance!