GraphSAGE unsupervised (AGA-only)Preview
|
This algorithm is only available in Aura Graph Analytics. |
Glossary
- Directed
-
Directed trait. The algorithm is well-defined on a directed graph.
- Directed
-
Directed trait. The algorithm ignores the direction of the graph.
- Directed
-
Directed trait. The algorithm does not run on a directed graph.
- Undirected
-
Undirected trait. The algorithm is well-defined on an undirected graph.
- Undirected
-
Undirected trait. The algorithm ignores the undirectedness of the graph.
- Heterogeneous nodes
-
Heterogeneous nodes fully supported. The algorithm has the ability to distinguish between nodes of different types.
- Heterogeneous nodes
-
Heterogeneous nodes allowed. The algorithm treats all selected nodes similarly regardless of their label.
- Heterogeneous relationships
-
Heterogeneous relationships fully supported. The algorithm has the ability to distinguish between relationships of different types.
- Heterogeneous relationships
-
Heterogeneous relationships allowed. The algorithm treats all selected relationships similarly regardless of their type.
- Weighted relationships
-
Weighted trait. The algorithm supports a relationship property to be used as weight, specified via the relationshipWeightProperty configuration parameter.
- Weighted relationships
-
Weighted trait. The algorithm treats each relationship as equally important, discarding the value of any relationship weight.
- Node properties
-
Node properties trait. The algorithm makes use of node properties.
Introduction
GraphSAGE is a graph neural network (GNN) architecture outlined in the paper Inductive Representation Learning on Large Graphs by Hamilton et al. (2017).
This section covers the syntax used to execute the GraphSAGE algorithm to generate unsupervised embeddings for nodes in a graph.
| For node classification, see GraphSAGE supervised. |
CALL gds.graphSage.unsupervised.train(
graphName: String,
configuration: Map
)
YIELD
preProcessingMillis: Integer,
trainMillis: Integer,
configuration: Map
| Name | Type | Default | Optional | Description |
|---|---|---|---|---|
graphName |
String |
|
no |
The name of a graph stored in the catalog. |
configuration |
Map |
|
yes |
Configuration for algorithm-specifics and/or graph filtering. |
| Name | Type | Default | Optional | Description |
|---|---|---|---|---|
activationFunction |
String |
|
yes |
The activation function to use. Valid values are "relu" and "sigmoid" |
aggregator |
String |
|
yes |
The neighborhood embedding aggregator to use. Valid values are "mean" and "max" |
batchSize |
Integer |
|
yes |
The number of target nodes to train on in each batch. If not provided, the algorithm will automatically infer the maximally allowed batch size within the constraints of available memory |
dropout |
Float |
|
yes |
The dropout probability for each layer. Must be a value >= 0.0 and < 1.0 |
embeddingDimension |
Integer |
|
yes |
The node embedding dimension of the model layers' outputs |
epochs |
Integer |
|
no |
The number of epochs to train the model |
featureProperties |
List of String |
|
no |
The names of the node properties that should be used as input features. All property names must exist in the projected graph and be of type Float or List of Float. |
jobId |
String |
|
yes |
An ID to more easily track the algorithm’s progress. |
layerNormalization |
Boolean |
|
yes |
Whether to apply layer normalization between the model layers |
learningRate |
Float |
|
yes |
The learning rate for the optimizer |
modelName |
String |
|
no |
The name of the model to train (must be unique) |
negativeSamplingRatio |
Float |
|
yes |
The ratio of negative to positive samples to sample for training |
nodeLabels |
List of String |
|
yes |
Filter the named graph using the given node labels. Nodes with any of the given labels will be included. |
numNeighbors |
List |
|
yes |
The number of neighbors to sample for each layer. Note that this also determines the number of layers |
numWalks |
Integer |
|
yes |
The number of random walks to perform for each node in the graph |
randomSeed |
String |
|
yes |
A number used to seed all randomness of the computation |
relationshipTypes |
List of String |
|
yes |
Filter the named graph using the given relationship types. Relationships with any of the given types will be included. |
walkDepth |
Integer |
|
yes |
The number of steps in every random walk |
| Name | Type | Description |
|---|---|---|
preProcessingMillis |
Integer |
Milliseconds for preprocessing the graph. |
trainMillis |
Integer |
Milliseconds to train the model. |
configuration |
Map |
The configuration used for running the algorithm. |
CALL gds.graphSage.unsupervised.stream(
graphName: String,
configuration: Map
)
YIELD
embedding: List,
nodeId: Integer
| Name | Type | Default | Optional | Description |
|---|---|---|---|---|
graphName |
String |
|
no |
The name of a graph stored in the catalog. |
configuration |
Map |
|
yes |
Configuration for algorithm-specifics and/or graph filtering. |
| Name | Type | Default | Optional | Description |
|---|---|---|---|---|
batchSize |
Integer |
|
yes |
The number of nodes per batch. |
featureProperties |
List of String |
|
no |
The names of the node properties that should be used as input features. All property names must exist in the projected graph and be of type Float or List of Float. |
jobId |
String |
|
yes |
An ID that can be provided to more easily track the algorithm’s progress. |
modelName |
String |
|
no |
The name of a GraphSAGE unsupervised model in the model catalog. |
nodeLabels |
List of String |
|
yes |
Filter the named graph using the given node labels. Nodes with any of the given labels will be included. |
randomSeed |
String |
|
yes |
A number used to seed all randomness of the computation |
relationshipTypes |
List of String |
|
yes |
Filter the named graph using the given relationship types. |
| Name | Type | Description |
|---|---|---|
embedding |
List of Float |
The computed node embedding. |
nodeId |
Integer |
Node ID. |
CALL gds.graphSage.unsupervised.mutate(
graphName: String,
configuration: Map
)
YIELD
computeMillis: Integer,
mutateMillis: Integer,
nodePropertiesWritten: Integer,
preProcessingMillis: Integer,
configuration: Map
| Name | Type | Default | Optional | Description |
|---|---|---|---|---|
graphName |
String |
|
no |
The name of a graph stored in the catalog. |
configuration |
Map |
|
yes |
Configuration for algorithm-specifics and/or graph filtering. |
| Name | Type | Default | Optional | Description |
|---|---|---|---|---|
batchSize |
Integer |
|
yes |
The number of nodes per batch. |
featureProperties |
List of String |
|
no |
The names of the node properties that should be used as input features. All property names must exist in the projected graph and be of type Float or List of Float. |
jobId |
String |
|
yes |
An ID that can be provided to more easily track the algorithm’s progress. |
modelName |
String |
|
no |
The name of a GraphSAGE unsupervised model in the model catalog. |
nodeLabels |
List of String |
|
yes |
Filter the named graph using the given node labels. Nodes with any of the given labels will be included. |
randomSeed |
String |
|
yes |
A number used to seed all randomness of the computation |
relationshipTypes |
List of String |
|
yes |
Filter the named graph using the given relationship types. |
mutateProperty |
String |
|
no |
The node property in the GDS graph to which the embedding is written. |
| Name | Type | Description |
|---|---|---|
computeMillis |
Integer |
Milliseconds for running the algorithm. |
mutateMillis |
Integer |
Milliseconds for adding properties to the projected graph. |
nodePropertiesWritten |
Integer |
Number of properties added to the projected graph. |
preProcessingMillis |
Integer |
Milliseconds for preprocessing the graph. |
configuration |
Map |
The configuration used for running the algorithm. |
CALL gds.graphSage.unsupervised.write(
graphName: String,
configuration: Map
)
YIELD
computeMillis: Integer,
nodePropertiesWritten: Integer,
preProcessingMillis: Integer,
writeMillis: Integer,
configuration: Map
| Name | Type | Default | Optional | Description |
|---|---|---|---|---|
graphName |
String |
|
no |
The name of a graph stored in the catalog. |
configuration |
Map |
|
yes |
Configuration for algorithm-specifics and/or graph filtering. |
| Name | Type | Default | Optional | Description |
|---|---|---|---|---|
batchSize |
Integer |
|
yes |
The number of nodes per batch. |
featureProperties |
List of String |
|
no |
The names of the node properties that should be used as input features. All property names must exist in the projected graph and be of type Float or List of Float. |
jobId |
String |
|
yes |
An ID that can be provided to more easily track the algorithm’s progress. |
modelName |
String |
|
no |
The name of a GraphSAGE unsupervised model in the model catalog. |
nodeLabels |
List of String |
|
yes |
Filter the named graph using the given node labels. Nodes with any of the given labels will be included. |
randomSeed |
String |
|
yes |
A number used to seed all randomness of the computation |
relationshipTypes |
List of String |
|
yes |
Filter the named graph using the given relationship types. |
writeConcurrency |
String |
|
yes |
The number of concurrent threads used for writing the node properties. |
writeProperty |
String |
|
no |
The node property in the Neo4j database to which the embedding is written |
| Name | Type | Description |
|---|---|---|
computeMillis |
Integer |
Milliseconds for running the algorithm. |
nodePropertiesWritten |
Integer |
Number of properties added to the projected graph. |
preProcessingMillis |
Integer |
Milliseconds for preprocessing the graph. |
writeMillis |
Integer |
Milliseconds for writing result data back. |
configuration |
Map |
The configuration used for running the algorithm. |