torchtraining.metrics.classification.binary¶
-
class
torchtraining.metrics.classification.binary.Accuracy(threshold: float = 0.0, reduction=<built-in method mean of type object>)[source]¶ Calculate accuracy score between
outputandtarget.Works for both logits and probabilities of
output.If
outputis tensor aftersigmoidactivation user should changethresholdto0.5for correct results (default0.0corresponds to unnormalized probability a.k.a logits).- Parameters
threshold (float, optional) – Threshold above which prediction is considered to be positive. Default:
0.0reduction (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 and containlogitsorprobabilities.targetsshould be of shape as well and containbooleanvalues (or integers from set ).- Returns
If
reductionis left as default mean is taken and single value returned. Otherwise whateverreductionreturns.- Return type
-
class
torchtraining.metrics.classification.binary.BalancedAccuracy(threshold: float = 0.0)[source]¶ Critical success index between
outputandtarget.Works for both logits and probabilities of
output.If
outputis tensor aftersigmoidactivation user should changethresholdto0.5for correct results (default0.0corresponds to unnormalized probability a.k.a logits).- Parameters
threshold (float, optional) – Threshold above which prediction is considered to be positive. Default:
0.0
-
forward(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputsfrom neural network andtargets(ground truths).outputsshould be of shape and containlogitsorprobabilities.targetsshould be of shape as well and containbooleanvalues (or integers from set ).- Returns
Scalar
tensor- Return type
-
class
torchtraining.metrics.classification.binary.ConfusionMatrix(threshold: float = 0.0, reduction=<built-in method sum of type object>)[source]¶ Confusion matrix between
outputandtarget.Works for both logits and probabilities of
output.If
outputis tensor aftersigmoidactivation user should changethresholdto0.5for correct results (default0.0corresponds to unnormalized probability a.k.a logits).- Parameters
threshold (float, optional) – Threshold above which prediction is considered to be positive. Default:
0.0reduction (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 and containlogitsorprobabilities.targetsshould be of shape as well and containbooleanvalues (or integers from set ).- Returns
If
reductionis left as default sum is taken and single value returned. Otherwise whateverreductionreturns.- Return type
-
class
torchtraining.metrics.classification.binary.CriticalSuccessIndex(threshold: float = 0.0)[source]¶ Critical success index between
outputandtarget.Works for both logits and probabilities of
output.If
outputis tensor aftersigmoidactivation user should changethresholdto0.5for correct results (default0.0corresponds to unnormalized probability a.k.a logits).- Parameters
threshold (float, optional) – Threshold above which prediction is considered to be positive. Default:
0.0
-
forward(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputsfrom neural network andtargets(ground truths).outputsshould be of shape and containlogitsorprobabilities.targetsshould be of shape as well and containbooleanvalues (or integers from set ).- Returns
Scalar
tensor- Return type
-
class
torchtraining.metrics.classification.binary.F1(threshold: float = 0.0)[source]¶ F1 score between
outputandtarget.Works for both logits and probabilities of
output.If
outputis tensor aftersigmoidactivation user should changethresholdto0.5for correct results (default0.0corresponds to unnormalized probability a.k.a logits).- Parameters
threshold (float, optional) – Threshold above which prediction is considered to be positive. Default:
0.0
-
forward(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputsfrom neural network andtargets(ground truths).outputsshould be of shape and containlogitsorprobabilities.targetsshould be of shape as well and containbooleanvalues (or integers from set ).- Returns
Scalar
tensor- Return type
-
class
torchtraining.metrics.classification.binary.FBeta(beta: float, threshold: float = 0.0)[source]¶ Get f-beta score between
outputsandtargets.Works for both logits and probabilities of
output.If
outputis tensor aftersigmoidactivation user should changethresholdto0.5for correct results (default0.0corresponds to unnormalized probability a.k.a logits).- Parameters
beta (float) – Beta coefficient of
f-betascore.threshold (float, optional) – Threshold above which prediction is considered to be positive. Default:
0.0data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputsfrom neural network andtargets(ground truths).outputsshould be of shape and containlogitsorprobabilities.targetsshould be of shape as well and containbooleanvalues (or integers from set ).
- Returns
Scalar
tensor- Return type
-
class
torchtraining.metrics.classification.binary.FalseDiscoveryRate(threshold: float = 0.0)[source]¶ False discovery rate between
outputandtarget.Works for both logits and probabilities of
output.If
outputis tensor aftersigmoidactivation user should changethresholdto0.5for correct results (default0.0corresponds to unnormalized probability a.k.a logits).- Parameters
threshold (float, optional) – Threshold above which prediction is considered to be positive. Default:
0.0
-
forward(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputsfrom neural network andtargets(ground truths).outputsshould be of shape and containlogitsorprobabilities.targetsshould be of shape as well and containbooleanvalues (or integers from set ).- Returns
Scalar
tensor- Return type
-
class
torchtraining.metrics.classification.binary.FalseNegative(threshold: float = 0.0, reduction=<built-in method sum of type object>)[source]¶ Number of false negatives between
outputandtarget.Works for both logits and probabilities of
output.If
outputis tensor aftersigmoidactivation user should changethresholdto0.5for correct results (default0.0corresponds to unnormalized probability a.k.a logits).- Parameters
threshold (float, optional) – Threshold above which prediction is considered to be positive. Default:
0.0reduction (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 and containlogitsorprobabilities.targetsshould be of shape as well and containbooleanvalues (or integers from set ).- Returns
If
reductionis left as default sum is taken and single value returned. Otherwise whateverreductionreturns.- Return type
-
class
torchtraining.metrics.classification.binary.FalseNegativeRate(threshold: float = 0.0)[source]¶ False negative rate between
outputandtarget.Works for both logits and probabilities of
output.If
outputis tensor aftersigmoidactivation user should changethresholdto0.5for correct results (default0.0corresponds to unnormalized probability a.k.a logits).- Parameters
threshold (float, optional) – Threshold above which prediction is considered to be positive. Default:
0.0
-
forward(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputsfrom neural network andtargets(ground truths).outputsshould be of shape and containlogitsorprobabilities.targetsshould be of shape as well and containbooleanvalues (or integers from set ).- Returns
Scalar
tensor- Return type
-
class
torchtraining.metrics.classification.binary.FalseOmissionRate(threshold: float = 0.0)[source]¶ False omission rate between
outputandtarget.Works for both logits and probabilities of
output.If
outputis tensor aftersigmoidactivation user should changethresholdto0.5for correct results (default0.0corresponds to unnormalized probability a.k.a logits).- Parameters
threshold (float, optional) – Threshold above which prediction is considered to be positive. Default:
0.0
-
forward(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputsfrom neural network andtargets(ground truths).outputsshould be of shape and containlogitsorprobabilities.targetsshould be of shape as well and containbooleanvalues (or integers from set ).- Returns
Scalar
tensor- Return type
-
class
torchtraining.metrics.classification.binary.FalsePositive(threshold: float = 0.0, reduction=<built-in method sum of type object>)[source]¶ Number of false positives between
outputandtarget.Works for both logits and probabilities of
output.If
outputis tensor aftersigmoidactivation user should changethresholdto0.5for correct results (default0.0corresponds to unnormalized probability a.k.a logits).- Parameters
threshold (float, optional) – Threshold above which prediction is considered to be positive. Default:
0.0reduction (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 and containlogitsorprobabilities.targetsshould be of shape as well and containbooleanvalues (or integers from set ).- Returns
If
reductionis left as default sum is taken and single value returned. Otherwise whateverreductionreturns.- Return type
-
class
torchtraining.metrics.classification.binary.FalsePositiveRate(threshold: float = 0.0)[source]¶ False positive rate between
outputandtarget.Works for both logits and probabilities of
output.If
outputis tensor aftersigmoidactivation user should changethresholdto0.5for correct results (default0.0corresponds to unnormalized probability a.k.a logits).- Parameters
threshold (float, optional) – Threshold above which prediction is considered to be positive. Default:
0.0
-
forward(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputsfrom neural network andtargets(ground truths).outputsshould be of shape and containlogitsorprobabilities.targetsshould be of shape as well and containbooleanvalues (or integers from set ).- Returns
Scalar
tensor- Return type
-
class
torchtraining.metrics.classification.binary.Jaccard(threshold: float = 0.0, reduction=<built-in method mean of type object>)[source]¶ Calculate jaccard score between
outputandtarget.Works for both logits and probabilities of
output.If
outputis tensor aftersigmoidactivation user should changethresholdto0.5for correct results (default0.0corresponds to unnormalized probability a.k.a logits).- Parameters
threshold (float, optional) – Threshold above which prediction is considered to be positive. Default:
0.0reduction (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 and containlogitsorprobabilities.targetsshould be of shape as well and containbooleanvalues (or integers from set ).- Returns
If
reductionis left as default mean is taken and single value returned. Otherwise whateverreductionreturns.- Return type
-
class
torchtraining.metrics.classification.binary.MatthewsCorrelationCoefficient(threshold: float = 0.0)[source]¶ Matthews correlation coefficient between
outputandtarget.Works for both logits and probabilities of
output.If
outputis tensor aftersigmoidactivation user should changethresholdto0.5for correct results (default0.0corresponds to unnormalized probability a.k.a logits).- Parameters
threshold (float, optional) – Threshold above which prediction is considered to be positive. Default:
0.0
-
forward(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputsfrom neural network andtargets(ground truths).outputsshould be of shape and containlogitsorprobabilities.targetsshould be of shape as well and containbooleanvalues (or integers from set ).- Returns
Scalar
tensor- Return type
-
class
torchtraining.metrics.classification.binary.NegativePredictiveValue(threshold: float = 0.0)[source]¶ Negative predictive value between
outputandtarget.Works for both logits and probabilities of
output.If
outputis tensor aftersigmoidactivation user should changethresholdto0.5for correct results (default0.0corresponds to unnormalized probability a.k.a logits).- Parameters
threshold (float, optional) – Threshold above which prediction is considered to be positive. Default:
0.0
-
forward(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputsfrom neural network andtargets(ground truths).outputsshould be of shape and containlogitsorprobabilities.targetsshould be of shape as well and containbooleanvalues (or integers from set ).- Returns
Scalar
tensor- Return type
-
class
torchtraining.metrics.classification.binary.Precision(threshold: float = 0.0)[source]¶ Precision between
outputandtarget.Works for both logits and probabilities of
output.If
outputis tensor aftersigmoidactivation user should changethresholdto0.5for correct results (default0.0corresponds to unnormalized probability a.k.a logits).- Parameters
threshold (float, optional) – Threshold above which prediction is considered to be positive. Default:
0.0
-
forward(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputsfrom neural network andtargets(ground truths).outputsshould be of shape and containlogitsorprobabilities.targetsshould be of shape as well and containbooleanvalues (or integers from set ).- Returns
Scalar
tensor- Return type
-
class
torchtraining.metrics.classification.binary.Recall(threshold: float = 0.0)[source]¶ Recall between
outputandtarget.Works for both logits and probabilities of
output.If
outputis tensor aftersigmoidactivation user should changethresholdto0.5for correct results (default0.0corresponds to unnormalized probability a.k.a logits).- Parameters
threshold (float, optional) – Threshold above which prediction is considered to be positive. Default:
0.0
-
forward(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputsfrom neural network andtargets(ground truths).outputsshould be of shape and containlogitsorprobabilities.targetsshould be of shape as well and containbooleanvalues (or integers from set ).- Returns
Scalar
tensor- Return type
-
class
torchtraining.metrics.classification.binary.Specificity(threshold: float = 0.0)[source]¶ Specificity between
outputandtarget.Works for both logits and probabilities of
output.If
outputis tensor aftersigmoidactivation user should changethresholdto0.5for correct results (default0.0corresponds to unnormalized probability a.k.a logits).- Parameters
threshold (float, optional) – Threshold above which prediction is considered to be positive. Default:
0.0
-
forward(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputsfrom neural network andtargets(ground truths).outputsshould be of shape and containlogitsorprobabilities.targetsshould be of shape as well and containbooleanvalues (or integers from set ).- Returns
Scalar
tensor- Return type
-
class
torchtraining.metrics.classification.binary.TrueNegative(threshold: float = 0.0, reduction=<built-in method sum of type object>)[source]¶ Number of true negatives between
outputandtarget.Works for both logits and probabilities of
output.If
outputis tensor aftersigmoidactivation user should changethresholdto0.5for correct results (default0.0corresponds to unnormalized probability a.k.a logits).- Parameters
threshold (float, optional) – Threshold above which prediction is considered to be positive. Default:
0.0reduction (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 and containlogitsorprobabilities.targetsshould be of shape as well and containbooleanvalues (or integers from set ).- Returns
If
reductionis left as default sum is taken and single value returned. Otherwise whateverreductionreturns.- Return type
-
class
torchtraining.metrics.classification.binary.TruePositive(threshold: float = 0.0, reduction=<built-in method sum of type object>)[source]¶ Number of true positives between
outputandtarget.Works for both logits and probabilities of
output.If
outputis tensor aftersigmoidactivation user should changethresholdto0.5for correct results (default0.0corresponds to unnormalized probability a.k.a logits).- Parameters
threshold (float, optional) – Threshold above which prediction is considered to be positive. Default:
0.0reduction (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 and containlogitsorprobabilities.targetsshould be of shape as well and containbooleanvalues (or integers from set ).- Returns
If
reductionis left as default sum is taken and single value returned. Otherwise whateverreductionreturns.- Return type