MCPcopy Create free account
hub / github.com/TrustAIResearch/MLHospital / evaluate

Function evaluate

mlh/examples/aia_example.py:110–122  ·  view source on GitHub ↗
(model, dataloader)

Source from the content-addressed store, hash-verified

108
109
110def evaluate(model, dataloader):
111 model.eval()
112 correct = 0
113 total = 0
114 for data in dataloader:
115 inputs, labels = data[0], data[1]['Young']
116 inputs, labels = inputs.to(args.device), labels.to(args.device)
117 outputs = model(inputs)
118 _, predicted = outputs.max(1)
119 total += labels.size(0)
120 correct += predicted.eq(labels).sum().item()
121 model.train()
122 return correct / total
123
124
125if __name__ == "__main__":

Callers 1

aia_example.pyFile · 0.70

Calls 2

evalMethod · 0.45
trainMethod · 0.45

Tested by

no test coverage detected