torchtraining.metrics.classification.multiclass¶
-
class
torchtraining.metrics.classification.multiclass.Accuracy(reduction=<built-in method mean of type object>)[source]¶ Calculate accuracy score between
outputandtarget.Works for both logits and probabilities of
outputout of the box.- Parameters
reduction (Callable(torch.Tensor) -> Any, optional) – One argument callable getting
torch.Tensorand returning argument after specified reduction. Default:torch.mean(mean across batch, user can usetorchtraining.savers.Meanto get mean across iterations/epochs).
-
forward(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputsfrom neural network andtargets(ground truths).outputsshould be of shape , where is the number of classes. Should containlogits(unnormalized probabilities) orprobabilitiesaftersoftmaxactivation or similar.targetsshould be of shape and contain integers in the range- Returns
If
reductionis left as default mean is taken and single value returned. Otherwise whateverreductionreturns.- Return type
-
class
torchtraining.metrics.classification.multiclass.BalancedAccuracy[source]¶ Critical success index between
outputandtarget.Works for both logits and probabilities of
outputout of the box.-
forward(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputsfrom neural network andtargets(ground truths).outputsshould be of shape , where is the number of classes. Should containlogits(unnormalized probabilities) orprobabilitiesaftersoftmaxactivation or similar.targetsshould be of shape and contain integers in the range- Returns
Scalar
tensor- Return type
-
-
class
torchtraining.metrics.classification.multiclass.ConfusionMatrix[source]¶ Confusion matrix between
outputandtarget.Works for both logits and probabilities of
outputout of the box.- Parameters
reduction (Callable, optional) – One argument callable getting
torch.Tensorand returningtorch.Tensor. Default:torch.sum(sum of all elements, user can usetorchtraining.savers.Sumto get sum across iterations/epochs).
-
forward(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputsfrom neural network andtargets(ground truths).outputsshould be of shape , where is the number of classes. Should containlogits(unnormalized probabilities) orprobabilitiesaftersoftmaxactivation or similar.targetsshould be of shape and contain integers in the range- Returns
If
reductionis left as default sum is taken and single value returned. Otherwise whateverreductionreturns.- Return type
-
class
torchtraining.metrics.classification.multiclass.CriticalSuccessIndex[source]¶ Critical success index between
outputandtarget.Works for both logits and probabilities of
outputout of the box.-
forward(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputsfrom neural network andtargets(ground truths).outputsshould be of shape , where is the number of classes. Should containlogits(unnormalized probabilities) orprobabilitiesaftersoftmaxactivation or similar.targetsshould be of shape and contain integers in the range- Returns
Scalar
tensor- Return type
-
-
class
torchtraining.metrics.classification.multiclass.F1[source]¶ F1 score between
outputandtarget.Works for both logits and probabilities of
outputout of the box.-
forward(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputsfrom neural network andtargets(ground truths).outputsshould be of shape , where is the number of classes. Should containlogits(unnormalized probabilities) orprobabilitiesaftersoftmaxactivation or similar.targetsshould 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
outputsandtargets.Works for both logits and probabilities of
outputout of the box.- Parameters
beta (float) – Beta coefficient of
f-betascore.data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputsfrom neural network andtargets(ground truths).outputsshould be of shape , where is the number of classes. Should containlogits(unnormalized probabilities) orprobabilitiesaftersoftmaxactivation or similar.targetsshould 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
outputandtarget.Works for both logits and probabilities of
outputout of the box.-
forward(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputsfrom neural network andtargets(ground truths).outputsshould be of shape , where is the number of classes. Should containlogits(unnormalized probabilities) orprobabilitiesaftersoftmaxactivation or similar.targetsshould 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
outputandtarget.Works for both logits and probabilities of
outputout of the box.- Parameters
reduction (Callable, optional) – One argument callable getting
torch.Tensorand returningtorch.Tensor. Default:torch.sum(sum of all elements, user can usetorchtraining.savers.Sumto get sum across iterations/epochs).
-
forward(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputsfrom neural network andtargets(ground truths).outputsshould be of shape , where is the number of classes. Should containlogits(unnormalized probabilities) orprobabilitiesaftersoftmaxactivation or similar.targetsshould be of shape and contain integers in the range- Returns
If
reductionis left as default sum is taken and single value returned. Otherwise whateverreductionreturns.- Return type
-
class
torchtraining.metrics.classification.multiclass.FalseNegativeRate[source]¶ False negative rate between
outputandtarget.Works for both logits and probabilities of
outputout of the box.-
forward(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputsfrom neural network andtargets(ground truths).outputsshould be of shape , where is the number of classes. Should containlogits(unnormalized probabilities) orprobabilitiesaftersoftmaxactivation or similar.targetsshould 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
outputandtarget.Works for both logits and probabilities of
outputout of the box.-
forward(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputsfrom neural network andtargets(ground truths).outputsshould be of shape , where is the number of classes. Should containlogits(unnormalized probabilities) orprobabilitiesaftersoftmaxactivation or similar.targetsshould 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
outputandtarget.Works for both logits and probabilities of
outputout of the box.- Parameters
reduction (Callable, optional) – One argument callable getting
torch.Tensorand returningtorch.Tensor. Default:torch.sum(sum of all elements, user can usetorchtraining.savers.Sumto get sum across iterations/epochs).
-
forward(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputsfrom neural network andtargets(ground truths).outputsshould be of shape , where is the number of classes. Should containlogits(unnormalized probabilities) orprobabilitiesaftersoftmaxactivation or similar.targetsshould be of shape and contain integers in the range- Returns
If
reductionis left as default sum is taken and single value returned. Otherwise whateverreductionreturns.- Return type
-
class
torchtraining.metrics.classification.multiclass.FalsePositiveRate[source]¶ False positive rate between
outputandtarget.Works for both logits and probabilities of
outputout of the box.-
forward(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputsfrom neural network andtargets(ground truths).outputsshould be of shape , where is the number of classes. Should containlogits(unnormalized probabilities) orprobabilitiesaftersoftmaxactivation or similar.targetsshould 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
outputandtarget.Works for both logits and probabilities of
outputout of the box.- Parameters
reduction (Callable(torch.Tensor) -> Any, optional) – One argument callable getting
torch.Tensorand returning argument after specified reduction. Default:torch.mean(mean across batch, user can usetorchtraining.savers.Meanto get mean across iterations/epochs).
-
forward(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputsfrom neural network andtargets(ground truths).outputsshould be of shape , where is the number of classes. Should containlogits(unnormalized probabilities) orprobabilitiesaftersoftmaxactivation or similar.targetsshould be of shape and contain integers in the range- Returns
If
reductionis left as default mean is taken and single value returned. Otherwise whateverreductionreturns.- Return type
-
class
torchtraining.metrics.classification.multiclass.MatthewsCorrelationCoefficient[source]¶ Matthews correlation coefficient between
outputandtarget.Works for both logits and probabilities of
outputout of the box.-
forward(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputsfrom neural network andtargets(ground truths).outputsshould be of shape , where is the number of classes. Should containlogits(unnormalized probabilities) orprobabilitiesaftersoftmaxactivation or similar.targetsshould 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
outputandtarget.Works for both logits and probabilities of
outputout of the box.-
forward(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputsfrom neural network andtargets(ground truths).outputsshould be of shape , where is the number of classes. Should containlogits(unnormalized probabilities) orprobabilitiesaftersoftmaxactivation or similar.targetsshould be of shape and contain integers in the range- Returns
Scalar
tensor- Return type
-
-
class
torchtraining.metrics.classification.multiclass.Precision[source]¶ Precision between
outputandtarget.Works for both logits and probabilities of
outputout of the box.-
forward(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputsfrom neural network andtargets(ground truths).outputsshould be of shape , where is the number of classes. Should containlogits(unnormalized probabilities) orprobabilitiesaftersoftmaxactivation or similar.targetsshould be of shape and contain integers in the range- Returns
Scalar
tensor- Return type
-
-
class
torchtraining.metrics.classification.multiclass.Recall[source]¶ Recall between
outputandtarget.Works for both logits and probabilities of
outputout of the box.-
forward(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputsfrom neural network andtargets(ground truths).outputsshould be of shape , where is the number of classes. Should containlogits(unnormalized probabilities) orprobabilitiesaftersoftmaxactivation or similar.targetsshould be of shape and contain integers in the range- Returns
Scalar
tensor- Return type
-
-
class
torchtraining.metrics.classification.multiclass.Specificity[source]¶ Specificity between
outputandtarget.Works for both logits and probabilities of
outputout of the box.-
forward(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputsfrom neural network andtargets(ground truths).outputsshould be of shape , where is the number of classes. Should containlogits(unnormalized probabilities) orprobabilitiesaftersoftmaxactivation or similar.targetsshould 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
outputsandtargets.Works for both logits and probabilities of
outputout of the box.- Parameters
k (int) – How many top results should be chosen.
reduction (Callable, optional) – One argument callable getting
torch.Tensorand returningtorch.Tensor. Default:torch.sum(sum of all elements, user can usetorchtraining.savers.Sumto get sum across iterations/epochs).data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputsfrom neural network andtargets(ground truths).outputsshould be of shape , where is the number of classes. Should containlogits(unnormalized probabilities) orprobabilitiesaftersoftmaxactivation or similar.targetsshould be of shape and contain integers in the range
- Returns
If
reductionis left as default mean is taken and single value returned. Otherwise whateverreductionreturns.- Return type
-
class
torchtraining.metrics.classification.multiclass.TrueNegative(reduction=<built-in method sum of type object>)[source]¶ Number of true negatives between
outputandtarget.Works for both logits and probabilities of
outputout of the box.- Parameters
reduction (Callable, optional) – One argument callable getting
torch.Tensorand returningtorch.Tensor. Default:torch.sum(sum of all elements, user can usetorchtraining.savers.Sumto get sum across iterations/epochs).
-
forward(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputsfrom neural network andtargets(ground truths).outputsshould be of shape , where is the number of classes. Should containlogits(unnormalized probabilities) orprobabilitiesaftersoftmaxactivation or similar.targetsshould be of shape and contain integers in the range- Returns
If
reductionis left as default sum is taken and single value returned. Otherwise whateverreductionreturns.- Return type
-
class
torchtraining.metrics.classification.multiclass.TruePositive(reduction=<built-in method sum of type object>)[source]¶ Number of false positives between
outputandtarget.Works for both logits and probabilities of
outputout of the box.- Parameters
reduction (Callable, optional) – One argument callable getting
torch.Tensorand returningtorch.Tensor. Default:torch.sum(sum of all elements, user can usetorchtraining.savers.Sumto get sum across iterations/epochs).
-
forward(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputsfrom neural network andtargets(ground truths).outputsshould be of shape , where is the number of classes. Should containlogits(unnormalized probabilities) orprobabilitiesaftersoftmaxactivation or similar.targetsshould be of shape and contain integers in the range- Returns
If
reductionis left as default sum is taken and single value returned. Otherwise whateverreductionreturns.- Return type