Conventions used
There are a number of text conventions used throughout this book.
Code in text
: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: “We set the model to evaluation mode using model.eval()
.”
A block of code is set as follows:
model.eval() _, pred = model(data.x, data.edge_index).max(dim=1) correct = float(pred[data.test_mask].eq( data.y[data.test_mask]).sum().item()) accuracy = correct / data.test_mask.sum().item() print(f'Accuracy: {accuracy:.4f}')
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
import torch import torch.nn.functional as F from torch_geometric.datasets import Planetoid from torch_geometric.nn import GCNConv # Load the Cora dataset dataset = Planetoid(root='data/Cora', name='Cora')
Any command-line input or output is written as follows:
pip install torch torch_geometric scikit-learn matplotlib networkx
Bold: Indicates a new term, an important word, or words that you see onscreen. For instance, words in menus or dialog boxes appear in bold. Here is an example: “In an e-commerce system, one possible use case is to predict the lifetime value (LTV) of customers based on their interactions with products and other features.”
Tips or important notes
Appear like this.