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.

Mapping nodes to their respective embedded vectors

Hi,

I have uploaded a adjacency matrix into neo4j and used node2vec to get the embedded vectors.I intend to use this on a machine learning classification problem where I have to add the output class as the last column to this embedded vectors,but I am not sure if the embedded vectors I obtained are in the same order(row-wise) as in the adjacency matrix.How do I make sure of this.Any help here would be highly appreciated.

 

2 REPLIES 2

If you return the nodeId and embeddings from nod2vec, you can then use gds.util.asNode(nodeId).outputClass 

https://neo4j.com/docs/graph-data-science/current/management-ops/utility-functions/

Hi,Could you be a bit more specific.I am sorry am new to this.This is my code

with 600 as noOfNodes

unwind range(1,noOfNodes) as index

create(n:Node{id: index})

 

load csv from "file:///adjmat.csv" as line

with line skip 1

with line, toInteger(line[0]) as startNode, size(line)-1 as noOfRelationships

match(n:Node{id: startNode})

unwind range(1, noOfRelationships) as index

match(m:Node{id: index})

create(n)-[r:REL]->(m)

set r.strength = toFloat(line[index])

Used this code to upload my 600*600 adjacent matrix

and den applied node to vec using

CALL gds.graph.project('all',

    [‘*'],

    {undirected:{type:'*', orientation:'UNDIRECTED'}})

CALL gds.beta.node2vec.stream("all", {walksPerNode: 2, embeddingDimension: 16})

And got the embedded vectors(600*16). which I exported as csv.Now i want to add an output class to this embedded vectors which I have in another excel .But I am not sure this is the right way to do it.Hope you understood my problem now