MCPcopy Create free account
hub / github.com/dmlc/dgl / accuracy

Function accuracy

examples/graphbolt/disk_based_feature/node_classification.py:18–24  ·  view source on GitHub ↗
(out, labels)

Source from the content-addressed store, hash-verified

16
17
18def accuracy(out, labels):
19 assert out.ndim == 2
20 assert out.size(0) == labels.size(0)
21 assert labels.ndim == 1 or (labels.ndim == 2 and labels.size(1) == 1)
22 labels = labels.flatten()
23 predictions = torch.argmax(out, 1)
24 return (labels == predictions).sum(dtype=torch.float64) / labels.size(0)
25
26
27class SAGE(nn.Module):

Callers 3

train_stepFunction · 0.70
layerwise_inferFunction · 0.70
evaluate_stepFunction · 0.70

Calls 2

flattenMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected