I'm following this guide to create the dataset for graph classification from my own data: https://docs.dgl.ai/en/0.6.x/new-tutorial/6_load_data.html
There they don't create any node's feature as it is not necessary if you are going to predict the graph class. In my case it is the same, I don't want to use any node feature (yet) for my classification.
To train the GNN I'm following this tutorial: https://docs.dgl.ai/tutorials/blitz/5_graph_classification.html#sphx-glr-tutorials-blitz-5-graph-classification-py
Both are from the official documentation but they seem to be incompatible because when I tried to use them together I received this error:
KeyError Traceback (most recent call last) <ipython-input-39-8a94f1fa250d> in <module>
4 for epoch in range(20):
5 for batched_graph, labels in train_dataloader:
----> 6 pred = model(batched_graph, batched_graph.ndata['attr'].float())
7 loss = F.cross_entropy(pred, labels)
8 optimizer.zero_grad()
~/anaconda3/lib/python3.8/site-packages/dgl/view.py in
__getitem__(self, key)
64 return ret
65 else:
---> 66 return self._graph._get_n_repr(self._ntid, self._nodes)[key]
67
68 def __setitem__(self, key, val):
~/anaconda3/lib/python3.8/site-packages/dgl/frame.py in
__getitem__(self, name)
391 Column data.
392 """
--> 393 return self._columns[name].data
394
395 def __setitem__(self, name, data):
KeyError: 'attr'
and I don't find another example to train a GNN with DGl without using the node's feature. Is it possible? Do I have to create fake attributes?
Thanks!