torchtraining.metrics.classification.multiclass¶
-
class
torchtraining.metrics.classification.multiclass.
Accuracy
(reduction=<built-in method mean of type object>)[source]¶ Calculate accuracy score between
output
andtarget
.Works for both logits and probabilities of
output
out of the box.- Parameters
reduction (Callable(torch.Tensor) -> Any, optional) – One argument callable getting
torch.Tensor
and returning argument after specified reduction. Default:torch.mean
(mean across batch, user can usetorchtraining.savers.Mean
to get mean across iterations/epochs).
-
forward
(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputs
from neural network andtargets
(ground truths).outputs
should be of shape , where is the number of classes. Should containlogits
(unnormalized probabilities) orprobabilities
aftersoftmax
activation or similar.targets
should be of shape and contain integers in the range- Returns
If
reduction
is left as default mean is taken and single value returned. Otherwise whateverreduction
returns.- Return type
-
class
torchtraining.metrics.classification.multiclass.
BalancedAccuracy
[source]¶ Critical success index between
output
andtarget
.Works for both logits and probabilities of
output
out of the box.-
forward
(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputs
from neural network andtargets
(ground truths).outputs
should be of shape , where is the number of classes. Should containlogits
(unnormalized probabilities) orprobabilities
aftersoftmax
activation or similar.targets
should be of shape and contain integers in the range- Returns
Scalar
tensor
- Return type
-
-
class
torchtraining.metrics.classification.multiclass.
ConfusionMatrix
[source]¶ Confusion matrix between
output
andtarget
.Works for both logits and probabilities of
output
out of the box.- Parameters
reduction (Callable, optional) – One argument callable getting
torch.Tensor
and returningtorch.Tensor
. Default:torch.sum
(sum of all elements, user can usetorchtraining.savers.Sum
to get sum across iterations/epochs).
-
forward
(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputs
from neural network andtargets
(ground truths).outputs
should be of shape , where is the number of classes. Should containlogits
(unnormalized probabilities) orprobabilities
aftersoftmax
activation or similar.targets
should be of shape and contain integers in the range- Returns
If
reduction
is left as default sum is taken and single value returned. Otherwise whateverreduction
returns.- Return type
-
class
torchtraining.metrics.classification.multiclass.
CriticalSuccessIndex
[source]¶ Critical success index between
output
andtarget
.Works for both logits and probabilities of
output
out of the box.-
forward
(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputs
from neural network andtargets
(ground truths).outputs
should be of shape , where is the number of classes. Should containlogits
(unnormalized probabilities) orprobabilities
aftersoftmax
activation or similar.targets
should be of shape and contain integers in the range- Returns
Scalar
tensor
- Return type
-
-
class
torchtraining.metrics.classification.multiclass.
F1
[source]¶ F1 score between
output
andtarget
.Works for both logits and probabilities of
output
out of the box.-
forward
(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputs
from neural network andtargets
(ground truths).outputs
should be of shape , where is the number of classes. Should containlogits
(unnormalized probabilities) orprobabilities
aftersoftmax
activation or similar.targets
should be of shape and contain integers in the range- Returns
Scalar
tensor
- Return type
-
-
class
torchtraining.metrics.classification.multiclass.
FBeta
(beta: float)[source]¶ Get f-beta score between
outputs
andtargets
.Works for both logits and probabilities of
output
out of the box.- Parameters
beta (float) – Beta coefficient of
f-beta
score.data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputs
from neural network andtargets
(ground truths).outputs
should be of shape , where is the number of classes. Should containlogits
(unnormalized probabilities) orprobabilities
aftersoftmax
activation or similar.targets
should be of shape and contain integers in the range
- Returns
Scalar
tensor
- Return type
-
class
torchtraining.metrics.classification.multiclass.
FalseDiscoveryRate
[source]¶ False discovery rate between
output
andtarget
.Works for both logits and probabilities of
output
out of the box.-
forward
(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputs
from neural network andtargets
(ground truths).outputs
should be of shape , where is the number of classes. Should containlogits
(unnormalized probabilities) orprobabilities
aftersoftmax
activation or similar.targets
should be of shape and contain integers in the range- Returns
Scalar
tensor
- Return type
-
-
class
torchtraining.metrics.classification.multiclass.
FalseNegative
(reduction=<built-in method sum of type object>)[source]¶ Number of false negatives between
output
andtarget
.Works for both logits and probabilities of
output
out of the box.- Parameters
reduction (Callable, optional) – One argument callable getting
torch.Tensor
and returningtorch.Tensor
. Default:torch.sum
(sum of all elements, user can usetorchtraining.savers.Sum
to get sum across iterations/epochs).
-
forward
(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputs
from neural network andtargets
(ground truths).outputs
should be of shape , where is the number of classes. Should containlogits
(unnormalized probabilities) orprobabilities
aftersoftmax
activation or similar.targets
should be of shape and contain integers in the range- Returns
If
reduction
is left as default sum is taken and single value returned. Otherwise whateverreduction
returns.- Return type
-
class
torchtraining.metrics.classification.multiclass.
FalseNegativeRate
[source]¶ False negative rate between
output
andtarget
.Works for both logits and probabilities of
output
out of the box.-
forward
(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputs
from neural network andtargets
(ground truths).outputs
should be of shape , where is the number of classes. Should containlogits
(unnormalized probabilities) orprobabilities
aftersoftmax
activation or similar.targets
should be of shape and contain integers in the range- Returns
Scalar
tensor
- Return type
-
-
class
torchtraining.metrics.classification.multiclass.
FalseOmissionRate
[source]¶ False omission rate between
output
andtarget
.Works for both logits and probabilities of
output
out of the box.-
forward
(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputs
from neural network andtargets
(ground truths).outputs
should be of shape , where is the number of classes. Should containlogits
(unnormalized probabilities) orprobabilities
aftersoftmax
activation or similar.targets
should be of shape and contain integers in the range- Returns
Scalar
tensor
- Return type
-
-
class
torchtraining.metrics.classification.multiclass.
FalsePositive
(reduction=<built-in method sum of type object>)[source]¶ Number of false positives between
output
andtarget
.Works for both logits and probabilities of
output
out of the box.- Parameters
reduction (Callable, optional) – One argument callable getting
torch.Tensor
and returningtorch.Tensor
. Default:torch.sum
(sum of all elements, user can usetorchtraining.savers.Sum
to get sum across iterations/epochs).
-
forward
(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputs
from neural network andtargets
(ground truths).outputs
should be of shape , where is the number of classes. Should containlogits
(unnormalized probabilities) orprobabilities
aftersoftmax
activation or similar.targets
should be of shape and contain integers in the range- Returns
If
reduction
is left as default sum is taken and single value returned. Otherwise whateverreduction
returns.- Return type
-
class
torchtraining.metrics.classification.multiclass.
FalsePositiveRate
[source]¶ False positive rate between
output
andtarget
.Works for both logits and probabilities of
output
out of the box.-
forward
(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputs
from neural network andtargets
(ground truths).outputs
should be of shape , where is the number of classes. Should containlogits
(unnormalized probabilities) orprobabilities
aftersoftmax
activation or similar.targets
should be of shape and contain integers in the range- Returns
Scalar
tensor
- Return type
-
-
class
torchtraining.metrics.classification.multiclass.
Jaccard
(reduction=<built-in method mean of type object>)[source]¶ Calculate Jaccard score between
output
andtarget
.Works for both logits and probabilities of
output
out of the box.- Parameters
reduction (Callable(torch.Tensor) -> Any, optional) – One argument callable getting
torch.Tensor
and returning argument after specified reduction. Default:torch.mean
(mean across batch, user can usetorchtraining.savers.Mean
to get mean across iterations/epochs).
-
forward
(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputs
from neural network andtargets
(ground truths).outputs
should be of shape , where is the number of classes. Should containlogits
(unnormalized probabilities) orprobabilities
aftersoftmax
activation or similar.targets
should be of shape and contain integers in the range- Returns
If
reduction
is left as default mean is taken and single value returned. Otherwise whateverreduction
returns.- Return type
-
class
torchtraining.metrics.classification.multiclass.
MatthewsCorrelationCoefficient
[source]¶ Matthews correlation coefficient between
output
andtarget
.Works for both logits and probabilities of
output
out of the box.-
forward
(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputs
from neural network andtargets
(ground truths).outputs
should be of shape , where is the number of classes. Should containlogits
(unnormalized probabilities) orprobabilities
aftersoftmax
activation or similar.targets
should be of shape and contain integers in the range- Returns
Scalar
tensor
- Return type
-
-
class
torchtraining.metrics.classification.multiclass.
NegativePredictiveValue
[source]¶ Negative predictive value between
output
andtarget
.Works for both logits and probabilities of
output
out of the box.-
forward
(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputs
from neural network andtargets
(ground truths).outputs
should be of shape , where is the number of classes. Should containlogits
(unnormalized probabilities) orprobabilities
aftersoftmax
activation or similar.targets
should be of shape and contain integers in the range- Returns
Scalar
tensor
- Return type
-
-
class
torchtraining.metrics.classification.multiclass.
Precision
[source]¶ Precision between
output
andtarget
.Works for both logits and probabilities of
output
out of the box.-
forward
(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputs
from neural network andtargets
(ground truths).outputs
should be of shape , where is the number of classes. Should containlogits
(unnormalized probabilities) orprobabilities
aftersoftmax
activation or similar.targets
should be of shape and contain integers in the range- Returns
Scalar
tensor
- Return type
-
-
class
torchtraining.metrics.classification.multiclass.
Recall
[source]¶ Recall between
output
andtarget
.Works for both logits and probabilities of
output
out of the box.-
forward
(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputs
from neural network andtargets
(ground truths).outputs
should be of shape , where is the number of classes. Should containlogits
(unnormalized probabilities) orprobabilities
aftersoftmax
activation or similar.targets
should be of shape and contain integers in the range- Returns
Scalar
tensor
- Return type
-
-
class
torchtraining.metrics.classification.multiclass.
Specificity
[source]¶ Specificity between
output
andtarget
.Works for both logits and probabilities of
output
out of the box.-
forward
(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputs
from neural network andtargets
(ground truths).outputs
should be of shape , where is the number of classes. Should containlogits
(unnormalized probabilities) orprobabilities
aftersoftmax
activation or similar.targets
should be of shape and contain integers in the range- Returns
Scalar
tensor
- Return type
-
-
class
torchtraining.metrics.classification.multiclass.
TopK
(k: int, reduction=<built-in method mean of type object>)[source]¶ Get top-k accuracy score between
outputs
andtargets
.Works for both logits and probabilities of
output
out of the box.- Parameters
k (int) – How many top results should be chosen.
reduction (Callable, optional) – One argument callable getting
torch.Tensor
and returningtorch.Tensor
. Default:torch.sum
(sum of all elements, user can usetorchtraining.savers.Sum
to get sum across iterations/epochs).data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputs
from neural network andtargets
(ground truths).outputs
should be of shape , where is the number of classes. Should containlogits
(unnormalized probabilities) orprobabilities
aftersoftmax
activation or similar.targets
should be of shape and contain integers in the range
- Returns
If
reduction
is left as default mean is taken and single value returned. Otherwise whateverreduction
returns.- Return type
-
class
torchtraining.metrics.classification.multiclass.
TrueNegative
(reduction=<built-in method sum of type object>)[source]¶ Number of true negatives between
output
andtarget
.Works for both logits and probabilities of
output
out of the box.- Parameters
reduction (Callable, optional) – One argument callable getting
torch.Tensor
and returningtorch.Tensor
. Default:torch.sum
(sum of all elements, user can usetorchtraining.savers.Sum
to get sum across iterations/epochs).
-
forward
(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputs
from neural network andtargets
(ground truths).outputs
should be of shape , where is the number of classes. Should containlogits
(unnormalized probabilities) orprobabilities
aftersoftmax
activation or similar.targets
should be of shape and contain integers in the range- Returns
If
reduction
is left as default sum is taken and single value returned. Otherwise whateverreduction
returns.- Return type
-
class
torchtraining.metrics.classification.multiclass.
TruePositive
(reduction=<built-in method sum of type object>)[source]¶ Number of false positives between
output
andtarget
.Works for both logits and probabilities of
output
out of the box.- Parameters
reduction (Callable, optional) – One argument callable getting
torch.Tensor
and returningtorch.Tensor
. Default:torch.sum
(sum of all elements, user can usetorchtraining.savers.Sum
to get sum across iterations/epochs).
-
forward
(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputs
from neural network andtargets
(ground truths).outputs
should be of shape , where is the number of classes. Should containlogits
(unnormalized probabilities) orprobabilities
aftersoftmax
activation or similar.targets
should be of shape and contain integers in the range- Returns
If
reduction
is left as default sum is taken and single value returned. Otherwise whateverreduction
returns.- Return type