Showing results for 
Search instead for 
Did you mean: 

Head's Up! Site migration is underway. Phase 2: migrate recent content

Real time recommendations using Link Prediction?


Hi Neo4j Community,

I'm interested in using link prediction in GDS to power real-time product recommendations. Can link prediction in GDS be used for real-time recommendations? Or is executing it too slow? What kind of computational complexity is link prediction?




Hi @JackGold,

The link prediction API as it currently stands is not really designed for real-time inferences. Every time you call `gds.beta.pipeline.linkPrediction.predict.*`  it does predictions of new possible neighbors for all nodes in the graph. Further, it runs the computation of all node property steps that was also used when training the pipelines (like node embedding algorithms if you're using that) on the entire input graph.
The complexity will depend on the node property steps, the machine learning method you use in your pipeline, and which search strategy you use for predictions (approximate or exhaustive).
If what you want to do in real-time is in fact to run predictions for all nodes in the graph, then the current API will probably do you quite well with the caveat that node property steps may be expensive to compute as I mentioned.

In general we are interested in improving this aspect of our API, mainly in two particular ways:

  • Being to compute node embeddings incrementally (as node property steps) so that they don't have to be recomputed for the entire graph again
  • Providing an API where a user can specify an explicit (sub)set of node pairs over which to make link predictions, and avoid computing predictions for all nodes in the graph

With these two improvements the LP pipeline API could work quite well for real-time node specific recommendations.

Would you be interested in such features?

Another concern is that if you want make predictions on nodes that are incrementally added to your database, you may need to make a new projection into GDS that includes them, since the GDS in-memory graph does not support you adding new nodes to it. But not sure what your use-case is