cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Euclidean Distance with Neo4j

Hello,

I am new to Neo4j, I am trying to calculate the euclidean distance between two samples of data labeled as Fraud(targetIds) and not Fraud(sourceIds). I am trying to use that query below. I have an error but I cannot find the source of the error. I checked the values in sourceIds, targetIds, transactions everything is ok. Could someone please assist me?

Thank you

MATCH (tx:Transaction)-[r:COMPLETED]->(t:Terminal)
WITH {item:id(tx), fraud: tx.tx_Fraud, weights: collect(coalesce(r.score,
gds.util.NaN()))} AS userData
WITH collect(userData) AS transactions
WITH transactions,
[value in transactions WHERE value.fraud=0 | value.item ]
AS sourceIds
WITH transactions,
[value in transactions WHERE value.fraud=1 | value.item ]
AS targetIds,sourceIds
CALL gds.alpha.similarity.euclidean.stream({
data: transactions,
sourceIds: sourceIds,
targetIds: targetIds,
topK: 1
})
YIELD item1, item2, similarity
WITH gds.util.asNode(item1) AS from, gds.util.asNode(item2) AS to, similarity
RETURN from.tx_Id AS from, to.tx_Id AS to, similarity
ORDER BY similarity DESC

log.txt (203.5 KB)

1 REPLY 1

Hmm looks ok to me.

Can you try with a smaller dataset like only 10 transactions?

And otherwise, can you please create an GitHub issue for it?