neo4j / graph-data-science

Source code for the Neo4j Graph Data Science library of graph algorithms.
https://neo4j.com/docs/graph-data-science/current/
Other
596 stars 157 forks source link

Link Prediction Pipeline throwing error when providing a range of values for model hyperparameter #212

Closed gurugecl closed 1 year ago

gurugecl commented 1 year ago

Neo4j desktop version 1.4.15 Neo4j version 4.4.5 GDS 2.0.3

Hi, I'm using Neo4j desktop and I'm creating a link prediction pipeline and have followed the documentation to do so. I would like to provide a range of values for certain hyperparameters when providing model candidates. I am using the exact code provided in the documentation to do so. However when I try to provide a range like so (which is the example provided in the documentation)

https://neo4j.com/docs/graph-data-science/current/machine-learning/linkprediction-pipelines/config/?utm_source=GPPC&utm_campaign=*NA%20-%20Search%20-%20Tier%200&utm_content=187497217113&utm_term=neo4j&gclid=EAIaIQobChMIkOvI6PXh2AIVgrfACh2NSQGfEAAYASAAEgJYx_D_BwE#tnotedef2

CALL gds.beta.pipeline.linkPrediction.addLogisticRegression('pipe', {maxEpochs: 500, penalty: {range: [1e-4, 1e2]}}) YIELD parameterSpace

I get the following error ClientError: [Procedure.ProcedureCallFailed] Failed to invoke procedure gds.beta.pipeline.linkPrediction.addLogisticRegression: Caused by: java.lang.IllegalArgumentException: The value of penalty must be of type Double but was HashMap.

The same happens for all other hyperparameters that accept Map Neo.ClientError.Procedure.ProcedureCallFailed Failed to invoke procedure gds.beta.pipeline.linkPrediction.addLogisticRegression: Caused by: java.lang.IllegalArgumentException: The value of maxEpochs must be of type Integer but was HashMap.

The documentation states that penalty accepts Float or Map and that A map should be of the form {range: [minValue, maxValue]}. It is used by auto-tuning. This is what I have provided

Please let me know if any other information is needed. Thank you

adamnsch commented 1 year ago

Hi @gurugecl,

The autotuning via providing hyperparameters as ranges is not available in GDS 2.0.X, you need GDS 2.1.X. That's why you're getting this error. Are you able to upgrade your GDS version to 2.1.X?

Regards, Adam

gurugecl commented 1 year ago

Hi @adamnsch, thank you very much for the prompt response! Yes I was able to upgrade to GDS version to 2.1.X and that worked