MCPcopy Create free account
hub / github.com/DeepGraphLearning/graphvite / NodeClassifier

Class NodeClassifier

python/graphvite/application/network.py:27–42  ·  view source on GitHub ↗

Node classification network for graphs

Source from the content-addressed store, hash-verified

25
26
27class NodeClassifier(nn.Module):
28 """
29 Node classification network for graphs
30 """
31 def __init__(self, embedding, num_class, normalization=False):
32 super(NodeClassifier, self).__init__()
33 if normalization:
34 embedding = embedding / np.linalg.norm(embedding, axis=1, keepdims=True)
35 embedding = torch.as_tensor(embedding)
36 self.embeddings = nn.Embedding.from_pretrained(embedding, freeze=True)
37 self.linear = nn.Linear(embedding.size(1), num_class, bias=True)
38
39 def forward(self, indexes):
40 x = self.embeddings(indexes)
41 x = self.linear(x)
42 return x
43
44
45class LinkPredictor(nn.Module):

Callers 1

linear_classificationFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected