Skip to content

Instantly share code, notes, and snippets.

@sidneyarcidiacono
Created May 17, 2021 20:56
Show Gist options
  • Save sidneyarcidiacono/920aa0c6f3a9b5bc26d5e48886a6785c to your computer and use it in GitHub Desktop.
Save sidneyarcidiacono/920aa0c6f3a9b5bc26d5e48886a6785c to your computer and use it in GitHub Desktop.
Train/test split with pytorch-geometric
# Now, we need to perform our train/test split.
# We create a seed, and then shuffle our data
torch.manual_seed(12345)
dataset = dataset.shuffle()
# Once it's shuffled, we slice the data to split
train_dataset = dataset[150:-150]
test_dataset = dataset[0:150]
# Take a look at the training versus test graphs
print(f'Number of training graphs: {len(train_dataset)}')
print(f'Number of test graphs: {len(test_dataset)}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment