sure, here you go :) @florentin_dorre
CALL gds.beta.pipeline.linkPrediction.create('pipe')
CALL gds.beta.pipeline.linkPrediction.addNodeProperty('pipe', 'fastRP', {
mutateProperty: 'embedding',
embeddingDimension: 256,
randomSeed: 42
})
CALL gds.beta.pipeline.linkPrediction.addFeature('pipe', 'hadamard', {
nodeProperties: ['embedding', 'projectPlannedRevenue', 'projectRevenueRatio', 'projectOverallSlippagePercent',
'projectCostRatio', 'projectTeamSize', 'projectDuration',
'totalRiskValue', 'avgRiskValue', 'riskCount', 'revenueToCostRatio', 'riskValue', 'riskDuration']
}) YIELD featureSteps
CALL gds.beta.pipeline.linkPrediction.configureSplit('pipe', {
testFraction: 0.25,
trainFraction: 0.6,
validationFolds: 3
})
YIELD splitConfig
CALL gds.beta.pipeline.linkPrediction.addLogisticRegression('pipe')
YIELD parameterSpace
CALL gds.beta.pipeline.linkPrediction.addRandomForest('pipe', {numberOfDecisionTrees: 10})
YIELD parameterSpace
CALL gds.alpha.pipeline.linkPrediction.configureAutoTuning('pipe', {
maxTrials: 2
}) YIELD autoTuningConfig
//(7) Project another graph
CALL gds.graph.project(
'myGraph1',
{
Project: {
label: 'Project',
properties: [
'projectPlannedRevenue',
'projectRevenueRatio',
'projectOverallSlippagePercent',
'projectCostRatio',
'projectTeamSize',
'projectDuration',
'totalRiskValue',
'avgRiskValue',
'riskCount',
'revenueToCostRatio',
'embedding'
]
},
Risk: {
label: 'Risk',
properties: [
'riskValue',
'riskDuration',
'embedding'
]
}
},
{
HAS_RISK: {
type: 'HAS_RISK',
orientation: 'UNDIRECTED'
}
}
);
CALL gds.beta.pipeline.linkPrediction.train('myGraph1', {
pipeline: 'pipe',
modelName: 'lp-pipeline-model',
metrics: ['AUCPR', 'OUT_OF_BAG_ERROR'],
targetRelationshipType: 'HAS_RISK',
randomSeed: 12
}) YIELD modelInfo, modelSelectionStats
RETURN
modelInfo.bestParameters AS winningModel,
modelInfo.metrics.AUCPR.train.avg AS avgTrainScore,
modelInfo.metrics.AUCPR.outerTrain AS outerTrainScore,
modelInfo.metrics.AUCPR.test AS testScore,
[cand IN modelSelectionStats.modelCandidates | cand.metrics.AUCPR.validation.avg] AS validationScores