neo4j-graph-analytics / ml-link-prediction-notebooks

Notebooks for the ML Link Prediction Course
14 stars 12 forks source link

IndexError in `apply_triangles_features()` #1

Open roger-yu-ds opened 2 years ago

roger-yu-ds commented 2 years ago

In (cell 32](https://github.com/neo4j-graph-analytics/ml-link-prediction-notebooks/blob/main/04_Predictions.ipynb), I get an IndexError:

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_21220/3422983529.py in <module>
----> 1 training_df = apply_triangles_features(training_df, "trianglesTrain", "coefficientTrain")
      2 test_df = apply_triangles_features(test_df, "trianglesTest", "coefficientTest")

~\AppData\Local\Temp/ipykernel_21220/2050145394.py in apply_triangles_features(data, triangles_prop, coefficient_prop)
     17     "coefficientProp": coefficient_prop
     18     }
---> 19     features = graph.run(query, params).to_data_frame()
     20     return pd.merge(data, features, on = ["node1", "node2"])

D:\Anaconda3\envs\data_science\lib\site-packages\py2neo\database.py in run(self, cypher, parameters, **kwparameters)
    403         :return:
    404         """
--> 405         return self.auto().run(cypher, parameters, **kwparameters)
    406 
    407     def evaluate(self, cypher, parameters=None, **kwparameters):

D:\Anaconda3\envs\data_science\lib\site-packages\py2neo\database.py in run(self, cypher, parameters, **kwparameters)
    976                 result = self._connector.run(self.ref, cypher, parameters)
    977             else:
--> 978                 result = self._connector.auto_run(cypher, parameters,
    979                                                   graph_name=self.graph.name,
    980                                                   readonly=self.readonly)

D:\Anaconda3\envs\data_science\lib\site-packages\py2neo\client\__init__.py in auto_run(self, cypher, parameters, pull, graph_name, readonly)
   1341             if pull != 0:
   1342                 try:
-> 1343                     cx.pull(result, n=pull)
   1344                 except TypeError:
   1345                     # If the RUN fails, so will the PULL, due to

D:\Anaconda3\envs\data_science\lib\site-packages\py2neo\client\bolt.py in pull(self, result, n, capacity)
    941         result.append(response, final=(n == -1))
    942         try:
--> 943             self._sync(response)
    944         except BrokenWireError as error:
    945             result.transaction.mark_broken()

D:\Anaconda3\envs\data_science\lib\site-packages\py2neo\client\bolt.py in _sync(self, *responses)
    745         self.send()
    746         for response in responses:
--> 747             self._wait(response)
    748 
    749     def _audit(self, task):

D:\Anaconda3\envs\data_science\lib\site-packages\py2neo\client\bolt.py in _wait(self, response)
    740         """
    741         while not response.full() and not response.done():
--> 742             self._fetch()
    743 
    744     def _sync(self, *responses):

D:\Anaconda3\envs\data_science\lib\site-packages\py2neo\client\bolt.py in _fetch(self)
    715         failed state into an exception.
    716         """
--> 717         tag, fields = self.read_message()
    718         if tag == 0x70:
    719             self._responses.popleft().set_success(**fields[0])

D:\Anaconda3\envs\data_science\lib\site-packages\py2neo\client\bolt.py in read_message(self)
    642 
    643     def read_message(self):
--> 644         tag, fields = self._reader.read_message()
    645         if tag == 0x71:
    646             # If a RECORD is received, check for more records

D:\Anaconda3\envs\data_science\lib\site-packages\py2neo\client\bolt.py in read_message(self)
     94                 chunks.append(self.wire.read(size))
     95         message = b"".join(chunks)
---> 96         _, n = divmod(message[0], 0x10)
     97         try:
     98             unpacker = UnpackStream(message, offset=2)

IndexError: index out of range

Versions

Component Version
Neo4j 4.3.1
GDS 1.6.1
tomasonjo commented 2 years ago

what version of neo4j/gds are you using?

roger-yu-ds commented 2 years ago

what version of neo4j/gds are you using?

Sorry for leaving this out. I've edited the original post too. Component Version
Neo4j 4.3.1
GDS 1.6.1
tomasonjo commented 2 years ago

I have tested it and it works on my end with the latest GDS 1.6.4. Have you executed all the previous cells? Try to update your GDS/py2neo version if it doesn't work.