In practice, if you are using GDS prior to version 1.3, embedding algorithms are not yet implemented. To train a model, you will have to extract data from Neo4j. We can do this with the karateclub package in a similar way to the previous section. For instance, we can use the following:
from karateclub import DeepWalk
dw = DeepWalk(walk_number=50, walk_length=15, dimensions=5)
For the DeepWalk algorithm, on top of the number of dimensions in the embedding space d, you can configure the following:
- The number of walks starting from the same node
- The length of each generated path
- The window size to use to generate pairs of nodes forming the training set
- Parameters for the neural network training, learning rate, and the number of epochs (iterations)
An alternative to DeepWalk, node2vec, adds two additional parameters to add more control to the random walk part of the algorithm.