Hi, thank you very much for your excellent work, I created my own dataset following the .json file format in your code, I had this problem after training part of my data, I observed the difference between our data, there is a non-connected graph in my data and there are isolated nodes, is this the reason why the code is wrong in the middle of training?
Training started.
Epoch: 0%| | 0/10 [00:00<?, ?it/s]
0%| | 0/25 [00:00<?, ?it/s]
(Loss=4.1643): 0%| | 0/25 [00:01<?, ?it/s]
(Loss=4.1643): 4%|▍ | 1/25 [00:01<00:29, 1.22s/it]
(Loss=1.1765): 4%|▍ | 1/25 [00:02<00:29, 1.22s/it]
(Loss=1.1765): 8%|▊ | 2/25 [00:02<00:28, 1.26s/it]
(Loss=-1.8768): 8%|▊ | 2/25 [00:03<00:28, 1.26s/it]
(Loss=-1.8768): 12%|█▏ | 3/25 [00:03<00:26, 1.20s/it]
(Loss=-1.1337): 12%|█▏ | 3/25 [00:04<00:26, 1.20s/it]
(Loss=-1.1337): 16%|█▌ | 4/25 [00:05<00:26, 1.27s/it]
Epoch: 0%| | 0/10 [00:05<?, ?it/s]
Traceback (most recent call last):
File "D:/GAM-master/src/main.py", line 19, in
main()
File "D:/GAM-master/src/main.py", line 14, in main
model.fit()
File "D:\GAM-master\src\gam.py", line 272, in fit
self.epoch_loss = self.epoch_loss + self.process_batch(batches[batch])
File "D:\GAM-master\src\gam.py", line 240, in process_batch
batch_loss = self.process_graph(graph_path, batch_loss)
File "D:\GAM-master\src\gam.py", line 221, in process_graph
predictions, node, attention_score = self.model(data, graph, features, node)
File "D:\anaconda\envs\spyder\lib\site-packages\torch\nn\modules\module.py", line 532, in call
result = self.forward(*input, **kwargs)
File "D:\GAM-master\src\gam.py", line 180, in forward
self.state, node, attention_score = self.step_block(data, graph, features, node)
File "D:\anaconda\envs\spyder\lib\site-packages\torch\nn\modules\module.py", line 532, in call
result = self.forward(*input, **kwargs)
File "D:\GAM-master\src\gam.py", line 97, in forward
feature_row, node, attention_score = self.make_step(node, graph, features,
File "D:\GAM-master\src\gam.py", line 78, in make_step
label = self.sample_node_label(orig_neighbors, graph, features)
File "D:\GAM-master\src\gam.py", line 66, in sample_node_label
label = np.random.choice(np.arange(len(self.identifiers)), p=normalized_attention_spread)
File "mtrand.pyx", line 928, in numpy.random.mtrand.RandomState.choice
ValueError: probabilities contain NaN
Process finished with exit code 1
Here's an example from my .json file
{"target": 1,"edges":[[0,2],[0,8],[0,12],[0,13],[0,14],[1,2],[1,8],[2,3],[2,8],[3,5],[6,14],[11,12],[11,13]],"labels":{"0":113,"1":106,"2":78,"3":102,"4":91,"5":63,"6":68,"7":76,"8":73,"9":119,"10":87,"11":102,"12":110,"13":117,"14":78,"15":124},"inverse_labels":{"113":[0],"106":[1],"78":[2,14],"102":[3,11],"91":[4],"63":[5],"68":[6],"76":[7],"73":[8],"119":[9],"87":[10],"110":[12],"117":[13],"124":[15]}}
Sorry for disturbing you, thank you very much for your help !