MCPcopy Create free account
hub / github.com/K-Quant/HiDy / SingleLayerTest

Function SingleLayerTest

application/FFD/ffd.py:94–109  ·  view source on GitHub ↗
(test_loader, MLP, loss_func)

Source from the content-addressed store, hash-verified

92
93
94def SingleLayerTest(test_loader, MLP, loss_func):
95 auc = 0.0
96 train_loss = 0.0
97 l = 0
98 for test_x, test_y in test_loader:
99 l += 1
100 predicted = MLP(test_x)
101 y = torch.unsqueeze(test_y, 1)
102 loss = loss_func(predicted, y)
103 train_loss += loss.item() * test_x.size(0)
104
105 predicted = torch.sigmoid(predicted)
106 predicted = torch.max(predicted, 1)
107 predicted = int(predicted.values >= 0.5)
108 auc += int(predicted == test_y)
109 return train_loss/l, auc/l
110
111
112

Callers 1

best_nerous_viaCVFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected