Skip to content

likelihood_model

Likelihood model.

Tensor = Annotated[Union[np.ndarray, torch.Tensor], PlainSerializer(_array_to_json, return_type=str), PlainValidator(_to_torch)] module-attribute #

Annotated tensor type, used to serialize arrays or tensors to JSON strings and deserialize them back to tensors.

GaussianLikelihoodConfig #

Bases: BaseModel

Gaussian likelihood configuration.

Source code in src/careamics/config/likelihood_model.py
class GaussianLikelihoodConfig(BaseModel):
    """Gaussian likelihood configuration."""

    model_config = ConfigDict(validate_assignment=True)

    predict_logvar: Optional[Literal["pixelwise"]] = None
    """If `pixelwise`, log-variance is computed for each pixel, else log-variance
    is not computed."""

    logvar_lowerbound: Union[float, None] = None
    """The lowerbound value for log-variance."""

logvar_lowerbound: Union[float, None] = None class-attribute instance-attribute #

The lowerbound value for log-variance.

predict_logvar: Optional[Literal['pixelwise']] = None class-attribute instance-attribute #

If pixelwise, log-variance is computed for each pixel, else log-variance is not computed.

NMLikelihoodConfig #

Bases: BaseModel

Noise model likelihood configuration.

Source code in src/careamics/config/likelihood_model.py
class NMLikelihoodConfig(BaseModel):
    """Noise model likelihood configuration."""

    model_config = ConfigDict(validate_assignment=True, arbitrary_types_allowed=True)

    # TODO remove and use as parameters to the likelihood functions?
    data_mean: Tensor = torch.zeros(1)
    """The mean of the data, used to unnormalize data for noise model evaluation.
    Shape is (target_ch,) (or (1, target_ch, [1], 1, 1))."""

    # TODO remove and use as parameters to the likelihood functions?
    data_std: Tensor = torch.ones(1)
    """The standard deviation of the data, used to unnormalize data for noise
    model evaluation. Shape is (target_ch,) (or (1, target_ch, [1], 1, 1))."""

    # TODO: serialization/deserialization for this
    noise_model: Optional[NoiseModel] = Field(default=None, exclude=True)
    """The noise model instance used to compute the likelihood."""

data_mean: Tensor = torch.zeros(1) class-attribute instance-attribute #

The mean of the data, used to unnormalize data for noise model evaluation. Shape is (target_ch,) (or (1, target_ch, [1], 1, 1)).

data_std: Tensor = torch.ones(1) class-attribute instance-attribute #

The standard deviation of the data, used to unnormalize data for noise model evaluation. Shape is (target_ch,) (or (1, target_ch, [1], 1, 1)).

noise_model: Optional[NoiseModel] = Field(default=None, exclude=True) class-attribute instance-attribute #

The noise model instance used to compute the likelihood.