MCPcopy
hub / github.com/facebookresearch/MetaCLIP / mean_per_class

Function mean_per_class

clipeval/eval_zeroshot.py:147–152  ·  view source on GitHub ↗
(outputs, targets)

Source from the content-addressed store, hash-verified

145
146
147def mean_per_class(outputs, targets):
148 pred = outputs.argmax(1)
149 confusion_matrix = metrics.confusion_matrix(targets, pred)
150 per_classes = confusion_matrix.diagonal() / confusion_matrix.sum(axis=1)
151
152 return 100 * per_classes.mean()
153
154
155def roc_auc(outputs, targets):

Callers 3

evaluate_logitsFunction · 0.90
evaluate_datasetFunction · 0.90
evaluateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected