question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RandomLinkSplit' object has no attribute 'num_features'

See original GitHub issue

❓ Questions & Help

I created my heterograph following steps from LOADING GRAPHS FROM CSV and now I’m trying to split the data data.train_mask = data.val_mask = data.test_mask = None data = T.RandomLinkSplit(data)

In the last version of PyG, train_test_split_edges is returning that its deprecated. So I used instead RandomLinkSplit and when I execute this line: encoder = VEncoder(data.num_features, out_channels=latent_size)

It returns: AttributeError: 'RandomLinkSplit' object has no attribute 'num_features'

What’s the equivalent of num_features ? I couldn’t find anything about this in the docs

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
anniekmyattcommented, Oct 4, 2021

Yes, you’re right, it is just like the behavior in deepsnap (I just double checked). I think your interface is a bit clearer, because in deepsnap you first call

dataset = GraphDataset([dg], task=task, edge_message_ratio=0.8 , edge_train_mode="disjoint")

and then

dataset_train, dataset_val, dataset_test = dataset.split(transductive=False, split_ratio=[0.8, 0.1, 0.1])

which could suggest to an unsuspecting user that 80% of edges are reserved for message passing, and 20% are supervision edges, and then you split those supervision edges using the [0.8, 0.1, 0.1] split ratio, yielding something like 80 message passing edges, 16 training supervision edges, 2 validation and 2 test edges. But this is not the case, the behaviour is as you implemented here.

I think the fact that you have it all handled in one function doesn’t give any counter-intuitive pointers like this and is much clearer.

Thanks again! 😃

0reactions
rusty1scommented, Oct 4, 2021

This is correct. I think this is similar to how DeepSNAP determines the train ratio of message passing edges and supervision edges. Let me know if this is the correct behavior in your opinion 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

torch_geometric.transforms - PyTorch Geometric
Converts the edge_index attributes of a homogeneous or heterogeneous data object into a (transposed) torch_sparse.SparseTensor type with key adj_t (functional ...
Read more >
Test edges are not excluded from train edges when ... - GitHub
Initialize a Data object as undirected graph. Set the random seed and split into train, validation and test sets using RandomLinkSplit.
Read more >
AttributeError: 'Batch' object has no attribute 'local_var'
I am currently working on doing graph classification on the IMDB-Binary dataset using deep learning and specifically the pytorch geometric ...
Read more >
Python attributeerror: 'list' object has no attribute 'split' Solution
This error tells us we are trying to use a function that is not available on lists. The split() operation only works on...
Read more >
RandomLinkSplit' object has no attribute 'num_features' #3183
It returns: AttributeError: 'RandomLinkSplit' object has no attribute 'num_features'. What's the equivalent of num_features ? I couldn't find anything about ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found