MCPcopy Create free account
hub / github.com/geekcomputers/Python / accuracy

Function accuracy

ML/src/python/neuralforge/utils/metrics.py:156–159  ·  view source on GitHub ↗
(predictions, targets)

Source from the content-addressed store, hash-verified

154 return self.matrix
155
156def accuracy(predictions, targets):
157 correct = (predictions == targets).sum()
158 total = len(targets)
159 return 100.0 * correct / total if total > 0 else 0.0
160
161def top_k_accuracy(output, target, k=5):
162 with torch.no_grad():

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected