dacapo.experiments.tasks.losses
Submodules
Package Contents
Classes
A class representing a dummy loss function that calculates the absolute difference between each prediction and target. |
|
A class used to represent the Mean Square Error Loss function (MSELoss). |
|
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
- class dacapo.experiments.tasks.losses.DummyLoss
A class representing a dummy loss function that calculates the absolute difference between each prediction and target.
Inherits the Loss class.
- compute(prediction, target, weight=None)
Calculate the total loss between prediction and target.
- compute(prediction, target, weight=None)
Method to calculate the total dummy loss.
- Parameters:
prediction (float or int) – predicted output
target (float or int) – true output
weight (float or int, optional) – weight parameter for the loss, by default None
- Returns:
Total loss calculated as the sum of absolute differences between prediction and target.
- Return type:
float or int
- class dacapo.experiments.tasks.losses.MSELoss
A class used to represent the Mean Square Error Loss function (MSELoss).
- None
- compute(prediction, target, weight):
Computes the MSELoss with the given weight for the predictiom and target.
- compute(prediction, target, weight)
Function to compute the MSELoss for the provided prediction and target, with respect to the weight.
Parameters:
- predictiontorch.Tensor
The prediction tensor for which loss needs to be calculated.
- targettorch.Tensor
The target tensor with respect to which loss is calculated.
- weighttorch.Tensor
The weight tensor used to weigh the prediction in the loss calculation.
Returns:
: torch.Tensor
The computed MSELoss tensor.
- class dacapo.experiments.tasks.losses.Loss
Helper class that provides a standard way to create an ABC using inheritance.
- abstract compute(prediction: torch.Tensor, target: torch.Tensor, weight: torch.Tensor | None = None) torch.Tensor
Compute the loss for the given prediction and target. Optionally, if given, a loss weight should be considered.
All arguments are
torchtensors. The return type should be atorchscalar that can be used with an optimizer, just as usual when training withtorch.
- class dacapo.experiments.tasks.losses.AffinitiesLoss(num_affinities: int, lsds_to_affs_weight_ratio: float)
Helper class that provides a standard way to create an ABC using inheritance.
- compute(prediction, target, weight)
Compute the loss for the given prediction and target. Optionally, if given, a loss weight should be considered.
All arguments are
torchtensors. The return type should be atorchscalar that can be used with an optimizer, just as usual when training withtorch.
- class dacapo.experiments.tasks.losses.HotDistanceLoss
Helper class that provides a standard way to create an ABC using inheritance.
- compute(prediction, target, weight)
Compute the loss for the given prediction and target. Optionally, if given, a loss weight should be considered.
All arguments are
torchtensors. The return type should be atorchscalar that can be used with an optimizer, just as usual when training withtorch.
- hot_loss(prediction, target, weight)
- distance_loss(prediction, target, weight)
- split(x)