MCPcopy
hub / github.com/THUDM/CogDL / LogisticRegression

Class LogisticRegression

examples/bgrl/models.py:117–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115
116
117class LogisticRegression(nn.Module):
118 def __init__(self, num_dim, num_class):
119 super().__init__()
120 self.linear = nn.Linear(num_dim, num_class)
121 torch.nn.init.xavier_uniform_(self.linear.weight.data)
122 self.linear.bias.data.fill_(0.0)
123 self.cross_entropy = nn.CrossEntropyLoss()
124
125 def forward(self, x, y):
126
127 logits = self.linear(x)
128 loss = self.cross_entropy(logits, y)
129
130 return logits, loss

Callers 4

evaluateMethod · 0.70
test_stepMethod · 0.50
evaluate_ncFunction · 0.50

Calls

no outgoing calls

Tested by 1

test_stepMethod · 0.40