Loss¶
-
class
Loss¶ Bases:
objectBase loss class that all other losses inherit.
Example:
class CustomLoss(Loss): def loss(self, predicted: Tensor, actual: Tensor) -> float: ... loss function def grad(self, predicted: Tensor, actual: Tensor) -> float: ... gradient of loss function
-
__init__()¶ Initialize self. See help(type(self)) for accurate signature.
Methods
__init__()Initialize self.
grad(predicted, actual)Calculates the loss function.
loss(predicted, actual)Calculates the loss function.
-
grad(predicted: numpy.ndarray, actual: numpy.ndarray) → float¶ Calculates the loss function.
- Parameters
predicted (
Tensor) – models outputactual (
Tensor) – expected output
- Raises
NotImplementedError –
-
loss(predicted: numpy.ndarray, actual: numpy.ndarray) → float¶ Calculates the loss function.
- Parameters
predicted (
Tensor) – models outputactual (
Tensor) – expected output
- Raises
NotImplementedError –
-