pytomography.likelihoods.mse_objective#
Module Contents#
Classes#
Negative mean squared error likelihood function \(L(g|f) = -\frac{1}{2} \alpha \sum_i \left(g_i-(Hf)_i\right)^2\) where \(g\) is the acquired data, \(H\) is the system matrix, \(f\) is the object being reconstructed, and \(\alpha\) is the scaling constant. The negative is taken so that the it works in gradient ascent (as opposed to descent) algorithms |
|
Generic likelihood class in PyTomography. Subclasses may implement specific likelihoods with methods to compute the likelihood itself as well as particular gradients of the likelihood |
- class pytomography.likelihoods.mse_objective.NegativeMSELikelihood(system_matrix, projections=None, additive_term=None, scaling_constant=1.0)[source]#
Bases:
pytomography.likelihoods.likelihood.LikelihoodNegative mean squared error likelihood function \(L(g|f) = -\frac{1}{2} \alpha \sum_i \left(g_i-(Hf)_i\right)^2\) where \(g\) is the acquired data, \(H\) is the system matrix, \(f\) is the object being reconstructed, and \(\alpha\) is the scaling constant. The negative is taken so that the it works in gradient ascent (as opposed to descent) algorithms
- Parameters:
system_matrix (SystemMatrix) – The system matrix modeling the particular system whereby the projections were obtained
projections (torch.Tensor) – Acquired data
additive_term (torch.Tensor, optional) – Additional term added after forward projection by the system matrix. This term might include things like scatter and randoms. Defaults to None.
additive_term_variance_estimate (torch.tensor, optional) – Variance estimate of the additive term. If none, then uncertainty estimation does not include contribution from the additive term. Defaults to None.
scaling_constant (float) –
- compute_gradient(object, subset_idx=None, norm_BP_subset_method='subset_specific')[source]#
Computes the gradient for the mean squared error objective function given by \(\nabla_f L(g|f) = H^T \left(g-Hf\right)\).
- Parameters:
object (torch.Tensor) – Object \(f\) on which the likelihood is computed
subset_idx (int | None, optional) – Specifies the subset for forward/back projection. If none, then forward/back projection is done over all subsets, and the entire projections \(g\) are used. Defaults to None.
norm_BP_subset_method (str, optional) – Specifies how \(H^T 1\) is calculated when subsets are used. If ‘subset_specific’, then uses \(H_m^T 1\). If average_of_subsets, then uses the average of all :math:`H_m^T 1`s for any given subset (scaled to the relative size of the subset if subsets are not equal size). Defaults to ‘subset_specific’.
- Returns:
The gradient of the Poisson likelihood.
- Return type:
torch.Tensor
- class pytomography.likelihoods.mse_objective.SARTWeightedNegativeMSELikelihood(system_matrix, projections, additive_term=None)[source]#
Bases:
pytomography.likelihoods.likelihood.LikelihoodGeneric likelihood class in PyTomography. Subclasses may implement specific likelihoods with methods to compute the likelihood itself as well as particular gradients of the likelihood
- Parameters:
system_matrix (SystemMatrix) – The system matrix modeling the particular system whereby the projections were obtained
projections (torch.Tensor | None) – Acquired data. If listmode, then this argument need not be provided, and it is set to a tensor of ones. Defaults to None.
additive_term (torch.Tensor, optional) – Additional term added after forward projection by the system matrix. This term might include things like scatter and randoms. Defaults to None.
additive_term_variance_estimate (Callable, optional) – Operator for variance estimate of additive term. If none, then uncertainty estimation does not include contribution from the additive term. Defaults to None.
- compute_gradient(object, subset_idx=None, norm_BP_subset_method='subset_specific')[source]#
Computes the gradient for the mean squared error objective function given by \(\nabla_f L(g|f) = H^T \left(g-Hf\right)\).
- Parameters:
object (torch.Tensor) – Object \(f\) on which the likelihood is computed
subset_idx (int | None, optional) – Specifies the subset for forward/back projection. If none, then forward/back projection is done over all subsets, and the entire projections \(g\) are used. Defaults to None.
norm_BP_subset_method (str, optional) – Specifies how \(H^T 1\) is calculated when subsets are used. If ‘subset_specific’, then uses \(H_m^T 1\). If average_of_subsets, then uses the average of all :math:`H_m^T 1`s for any given subset (scaled to the relative size of the subset if subsets are not equal size). Defaults to ‘subset_specific’.
- Returns:
The gradient of the Poisson likelihood.
- Return type:
torch.Tensor