-
Hi, Thank you for all the work and help that you offer to all the community. I'm having a dataset of graphs, which looks like this: Data(edge_attr=[444, 1], edge_index=[2, 444], x=[251, 4], y=[2]). My goal is to predict those 2 values in y, which characterize the whole graph by taking some X graphs and predicting the y for the next X+3 graphs (3 is an example). I have divided my pytorch_geometric graphs into train, validation, and test sets and I have written some code using graph transformers. But I'm a bit confused about how to approach the problem as long as the dataset is concerned. I suppose it's a regression problem and that the loss function I should use is MSE or MAE loss. Could you please enlighten me with which approach I should tackle this problem? Thank you for your time, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 15 replies
-
Interesting problem. You could try to implement a dataset wrapper class, that returns 3 graphs and the labels of the fourth: class GroupDataset(torch.utils.data.Dataset):
def __init__(self, dataset, window=3):
super().__init__()
self.dataset = dataset
self.window = window
def __len__(self):
return len(self.dataset) - self.window
def __getitem__(self, idx):
data_list = [self.dataset[idx + offset] for offset in range(self.window)
y = self.dataset[idx + self.window].y
return data_list, y |
Beta Was this translation helpful? Give feedback.
Interesting problem. You could try to implement a dataset wrapper class, that returns 3 graphs and the labels of the fourth: