Metrics
Classification metrics computed on tensors.
| Function | Description |
|---|---|
accuracy pred target | Fraction of matching elements between predictions and targets. |
| Both tensors must have the same shape (class indices, not logits). | |
accuracyFromLogits logits target | Accuracy from logits: take argmax over the last dimension, then compare to target indices. |
f1 numClasses pred target | Per-class F1 score: . |
precision numClasses pred target | Per-class precision: TP / (TP + FP). Returns NaN for classes with no predicted positives. |
recall numClasses pred target | Per-class recall: TP / (TP + FN). Returns NaN for classes with no actual positives. |
accuracy
accuracy pred target
Fraction of matching elements between predictions and targets. Both tensors must have the same shape (class indices, not logits).
Parameters
pred:Tensortarget:Tensor
Returns float
accuracyFromLogits
accuracyFromLogits logits target
Accuracy from logits: take argmax over the last dimension, then compare to target indices.
Parameters
logits:Tensortarget:Tensor
Returns float
f1
f1 numClasses pred target
Per-class F1 score: .
Parameters
numClasses:intpred:Tensortarget:Tensor
Returns float list
precision
precision numClasses pred target
Per-class precision: TP / (TP + FP). Returns NaN for classes with no predicted positives.
Parameters
numClasses:intpred:Tensortarget:Tensor
Returns float list
recall
recall numClasses pred target
Per-class recall: TP / (TP + FN). Returns NaN for classes with no actual positives.
Parameters
numClasses:intpred:Tensortarget:Tensor
Returns float list