spektral.datasets.citation.load_data() not found


I am trying to use the CoRA dataset to train a graph neural network on tensorflow and it’s my first time using Spektral.

After some research on the internet, I learnt that there’s supposed to be a useful loader function that comes with Spektral for me to load this benchmark dataset so I attempted to implement it:


Then I got this:

AttributeError: module 'spektral.datasets.citation' has no attribute 'load_data'

I checked the Spektral documentation and I didn’t find the load_data loader function so I think there’s an update or something.

It would be helpful if anybody can provide any alternatives or a possible explanation for the error.


I solved the problem myself after some more research. For Spektral version 1.1.0, I think this does the job of the loader function in terms of using the CoRA dataset:

cora_dataset = spektral.datasets.citation.Citation(name='cora')
test_mask = cora_dataset.mask_te
train_mask = cora_dataset.mask_tr
val_mask = cora_dataset.mask_va
graph = cora_dataset.graphs[0]
features = graph.x
adj = graph.a
labels = graph.y

Answered By – playerJX1

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published