torchtraining.metrics.regression¶
-
class
torchtraining.metrics.regression.
AbsoluteError
(reduction=<built-in method mean of type object>)[source]¶ Absolute error between
outputs
andtargets
.- 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 and regressiontargets
.outputs
should be of shape , where is the number of samples. Should containfloating
point values.targets
should be in the same shapeoutputs
and be offloat
data type as well.- Returns
If
reduction
is left as default mean is taken and single value returned. Otherwise whateverreduction
returns.- Return type
-
class
torchtraining.metrics.regression.
AdjustedR2
(p: int)[source]¶ Adjusted R2 score between
outputs
andtargets
.- Parameters
p (int) – Number of explanatory terms in model.
-
forward
(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputs
from neural network and regressiontargets
.outputs
should be of shape , where is the number of samples. Should containfloating
point values.targets
should be in the same shapeoutputs
and be offloat
data type as well.- Returns
Scalar
tensor
- Return type
-
class
torchtraining.metrics.regression.
MaxError
[source]¶ Maximum error between
outputs
andtargets
.-
forward
(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputs
from neural network and regressiontargets
.outputs
should be of shape , where is the number of samples. Should containfloating
point values.targets
should be in the same shapeoutputs
and be offloat
data type as well.- Returns
Scalar
tensor
- Return type
-
-
class
torchtraining.metrics.regression.
R2
[source]¶ R2 score between
outputs
andtargets
.-
forward
(data)[source]¶ - Parameters
data (Tuple[torch.Tensor, torch.Tensor]) – Tuple containing
outputs
from neural network and regressiontargets
.outputs
should be of shape , where is the number of samples. Should containfloating
point values.targets
should be in the same shapeoutputs
and be offloat
data type as well.- Returns
Scalar
tensor
- Return type
-
-
class
torchtraining.metrics.regression.
RegressionOfSquares
(reduction=<built-in method sum of type object>)[source]¶ Regression of squares between
outputs
andtargets
.- 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 and regressiontargets
.outputs
should be of shape , where is the number of samples. Should containfloating
point values.targets
should be in the same shapeoutputs
and be offloat
data type as well.- Returns
If
reduction
is left as default sum is taken and single value returned. Otherwise whateverreduction
returns.- Return type
-
class
torchtraining.metrics.regression.
SquaredError
(reduction=<built-in method mean of type object>)[source]¶ Squared error between
outputs
andtargets
.- 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 and regressiontargets
.outputs
should be of shape , where is the number of samples. Should containfloating
point values.targets
should be in the same shapeoutputs
and be offloat
data type as well.- Returns
If
reduction
is left as default mean is taken and single value returned. Otherwise whateverreduction
returns.- Return type
-
class
torchtraining.metrics.regression.
SquaredLogError
(reduction=<built-in method mean of type object>)[source]¶ Squared log error between
outputs
andtargets
.- 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 and regressiontargets
.outputs
should be of shape , where is the number of samples. Should containfloating
point values.targets
should be in the same shapeoutputs
and be offloat
data type as well.- Returns
If
reduction
is left as default mean is taken and single value returned. Otherwise whateverreduction
returns.- Return type
-
class
torchtraining.metrics.regression.
SquaresOfResiduals
(reduction=<built-in method sum of type object>)[source]¶ Square of residuals between
outputs
andtargets
.- 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 and regressiontargets
.outputs
should be of shape , where is the number of samples. Should containfloating
point values.targets
should be in the same shapeoutputs
and be offloat
data type as well.- Returns
If
reduction
is left as default sum is taken and single value returned. Otherwise whateverreduction
returns.- Return type
-
class
torchtraining.metrics.regression.
TotalOfSquares
(reduction=<built-in method sum of type object>)[source]¶ Total of squares of single
tensor
.- 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 (torch.Tensor) – Tensor containing
float
data of any shape. Usuallytargets
.- Returns
If
reduction
is left as default {} is taken and single value returned. Otherwise whateverreduction
returns.- Return type