Hi,
I am trying to use the gds.beta.graphSage.train module and having some challenges. Firstly with the multi-label approach. If I create my graph catalogue with the following code I should get two node labels (output & tx) along with relationship (PAYS):
CALL gds.graph.create(
'addresses_with_transactions',
{
output: {
label: 'output',
properties: ['onehotencode', 'pageRank', 'depth']
},
tx: {
label: 'tx',
properties: ['pageRank', 'depth', 'time_stamp']
}
}, {
PAYS: {
type: 'PAYS',
properties: ['amount','time_stamp']
}
})
When I try to train a model using these properties i get an error
First, I tried this way:
CALL gds.beta.graphSage.train(
'addresses_with_transactions',
{
modelName: 'TrainModel',
featureProperties: ['onehotencode', 'pageRank', 'depth', 'time_stamp', 'amount'],
projectedFeatureDimension: 5
}
)
I got this error:
Failed to invoke procedure gds.beta.graphSage.train
: Caused by: java.lang.IllegalArgumentException: The feature properties ['amount'] are not present for all requested labels. Requested labels: ['output', 'tx']. Properties available on all requested labels: ['depth', 'pageRank']
then tried another way:
CALL gds.beta.graphSage.train(
'addresses_with_transactions',
{
modelName: 'weightedTrainedModel',
featureProperties: ['onehotencode', 'pageRank', 'depth', 'time_stamp'],
aggregator: 'mean',
activationFunction: 'sigmoid',
sampleSizes: [25, 10],
degreeAsProperty: true,
relationshipWeightProperty: 'amount',
nodeLabels: ['output', 'tx'],
relationshipTypes: ['PAYS']
}
)
and got the a similar error:
Failed to invoke procedure gds.beta.graphSage.train
: Caused by: java.lang.IllegalArgumentException: The following node properties are not present for each label in the graph: [onehotencode, time_stamp]. Properties that exist for each label are [pageRank, depth]
So i decided to try it with just one node label (output) and just use the properties associated to 'output' in my catalogue, i used this:
CALL gds.beta.graphSage.train(
'addresses_with_transactions',
{
modelName: 'weightedTrainedModel',
featureProperties: ['onehotencode', 'pageRank', 'depth'],
aggregator: 'mean',
activationFunction: 'sigmoid',
sampleSizes: [25, 10],
degreeAsProperty: true,
relationshipWeightProperty: 'amount',
nodeLabels: ['output'],
relationshipTypes: ['PAYS']
}
)
The got an error:
Failed to invoke procedure gds.beta.graphSage.train
: Caused by: java.lang.IllegalStateException: Unknown ValueType LONG_ARRAY
However, I thought this data structure type was ok to use?
according to this page: Node Properties - Neo4j Graph Data Science
The following table lists the supported property types, as well as, their corresponding fallback values.
** Long
- Long.MIN_VALUE
*
** Double
- NaN
*
** Long Array
- null
*
** Float Array
- null
*
** Double Array
- null
*
In sum, I must be doing something wrong I cannot get the multi-label mode working with my model and I am having a problem with the LongArray type....any help greatly appreciated :)
Thanks,
Adam
PS. Just to let you know the function works when i strip out the long array and just use:
CALL gds.beta.graphSage.train(
'addresses_with_transactions',
{
modelName: 'weightedTrainedModel',
featureProperties: ['pageRank'],
aggregator: 'mean',
activationFunction: 'sigmoid',
sampleSizes: [25, 10],
degreeAsProperty: true,
relationshipWeightProperty: 'amount',
nodeLabels: ['output'],
relationshipTypes: ['PAYS']
}
)