LSST Applications g0f08755f38+9c285cab97,g1635faa6d4+13f3999e92,g1653933729+a8ce1bb630,g1a0ca8cf93+bf6eb00ceb,g28da252d5a+0829b12dee,g29321ee8c0+5700dc9eac,g2bbee38e9b+9634bc57db,g2bc492864f+9634bc57db,g2cdde0e794+c2c89b37c4,g3156d2b45e+41e33cbcdc,g347aa1857d+9634bc57db,g35bb328faa+a8ce1bb630,g3a166c0a6a+9634bc57db,g3e281a1b8c+9f2c4e2fc3,g414038480c+077ccc18e7,g41af890bb2+fde0dd39b6,g5fbc88fb19+17cd334064,g781aacb6e4+a8ce1bb630,g80478fca09+55a9465950,g82479be7b0+d730eedb7d,g858d7b2824+9c285cab97,g9125e01d80+a8ce1bb630,g9726552aa6+10f999ec6a,ga5288a1d22+2a84bb7594,gacf8899fa4+c69c5206e8,gae0086650b+a8ce1bb630,gb58c049af0+d64f4d3760,gc28159a63d+9634bc57db,gcf0d15dbbd+4b7d09cae4,gda3e153d99+9c285cab97,gda6a2b7d83+4b7d09cae4,gdaeeff99f8+1711a396fd,ge2409df99d+5e831397f4,ge79ae78c31+9634bc57db,gf0baf85859+147a0692ba,gf3967379c6+41c94011de,gf3fb38a9a8+8f07a9901b,gfb92a5be7c+9c285cab97,w.2024.46
LSST Data Management Base Package
|
Base class for optimizer/sampler likelihood functions that compute likelihood at a point. More...
#include <Likelihood.h>
Public Member Functions | |
int | getDataDim () const |
Return the number of data points. | |
int | getAmplitudeDim () const |
Return the number of linear parameters (columns of the model matrix) | |
int | getNonlinearDim () const |
Return the number of nonlinear parameters (which parameterize the model matrix) | |
int | getFixedDim () const |
Return the number of fixed nonlinear parameters (set on Likelihood construction) | |
ndarray::Array< Scalar const, 1, 1 > | getFixed () const |
Return the vector of fixed nonlinear parameters. | |
ndarray::Array< Pixel const, 1, 1 > | getData () const |
Return the vector of weighted, scaled data points \(z\). | |
ndarray::Array< Pixel const, 1, 1 > | getUnweightedData () const |
Return the vector of unweighted data points \(y\). | |
ndarray::Array< Pixel const, 1, 1 > | getWeights () const |
Return the vector of weights \(w\) applied to data points and model matrix rows. | |
ndarray::Array< Pixel const, 1, 1 > | getVariance () const |
Return the vector of per-data-point variances. | |
std::shared_ptr< Model > | getModel () const |
Return an object that defines the model and its parameters. | |
virtual void | computeModelMatrix (ndarray::Array< Pixel, 2,-1 > const &modelMatrix, ndarray::Array< Scalar const, 1, 1 > const &nonlinear, bool doApplyWeights=true) const =0 |
Evaluate the model for the given vector of nonlinear parameters. | |
virtual | ~Likelihood () |
Likelihood (const Likelihood &)=delete | |
Likelihood & | operator= (const Likelihood &)=delete |
Likelihood (Likelihood &&)=delete | |
Likelihood & | operator= (Likelihood &&)=delete |
Protected Member Functions | |
Likelihood (std::shared_ptr< Model > model, ndarray::Array< Scalar const, 1, 1 > const &fixed) | |
Protected Attributes | |
std::shared_ptr< Model > | _model |
ndarray::Array< Scalar const, 1, 1 > | _fixed |
ndarray::Array< Pixel, 1, 1 > | _data |
ndarray::Array< Pixel, 1, 1 > | _unweightedData |
ndarray::Array< Pixel, 1, 1 > | _variance |
ndarray::Array< Pixel, 1, 1 > | _weights |
Base class for optimizer/sampler likelihood functions that compute likelihood at a point.
Likelihood abstracts the problem of computing the likelihood over different kinds of data. It is responsible for creating a "model matrix" that maps amplitudes to data values, and maintaining a vector of scaled, weighted data values that corresponds to it. Its components can be represented best in the mathematical formula for a -log likelihood assuming Gaussian data and a model with both nonlinear parameters \(\theta\) and linear ("amplitude") parameters \(\alpha\):
\[ L(\alpha,\theta) = \frac{1}{2}\left(y - A(\theta)\alpha\right)^T\, \Sigma^{-1}\,\left(y - A(\theta)\alpha\right) \]
where \(y\) is the data vector, \(\Sigma\) is the data covariance matrix (assumed to be diagonal), and \(A(\theta)\) is the "true" model matrix (parametrized on the nonlinear parameters).
When fitting or sampling from the likelihood, however, we don't want to use these quantities directly, and they aren't what the Likelihood class provides. Instead, we reparametrize with:
\[ w_i \equiv \Sigma_{i,i}^{-1/2} \]
\[ z_i = w_i y_i \]
\[ B_{i,j} = w_i A_{i,j} \]
resulting in the equivalent formula:
\[ L(\alpha,\theta) = \frac{1}{2}\left(z-B(\theta)\alpha\right)^T\,\left(z-B(\theta)\alpha\right) \]
The \(w_i\) are the weights, which are applied to both the data vector and the model matrix to account for the noise in the data. In some cases, we may choose to use a constant weight rather than per-pixel weights, but will will still use a vector to represent it.
Definition at line 69 of file Likelihood.h.
|
inlinevirtual |
Definition at line 126 of file Likelihood.h.
|
delete |
|
delete |
|
inlineprotected |
Definition at line 138 of file Likelihood.h.
|
pure virtual |
Evaluate the model for the given vector of nonlinear parameters.
[out] | modelMatrix | The dataDim x amplitudeDim matrix \(B\) that expresses the model projected in such a way that it can be compared to the data when multiplied by an amplitude vector \(\alpha\). It should be weighted if the data vector is. The caller is responsible for guaranteeing that the shape of the matrix correct, but implementations should not assume anything about the initial values of the matrix elements. |
[in] | nonlinear | Vector of nonlinear parameters at which to evaluate the model. |
[in] | doApplyWeights | If False, do not apply the weights to the modelMatrix. |
Implemented in lsst::meas::modelfit::MultiShapeletPsfLikelihood, and lsst::meas::modelfit::UnitTransformedLikelihood.
|
inline |
Return the number of linear parameters (columns of the model matrix)
Definition at line 77 of file Likelihood.h.
|
inline |
Return the vector of weighted, scaled data points \(z\).
Definition at line 89 of file Likelihood.h.
|
inline |
|
inline |
|
inline |
Return the number of fixed nonlinear parameters (set on Likelihood construction)
Definition at line 83 of file Likelihood.h.
|
inline |
Return an object that defines the model and its parameters.
Definition at line 105 of file Likelihood.h.
|
inline |
Return the number of nonlinear parameters (which parameterize the model matrix)
Definition at line 80 of file Likelihood.h.
|
inline |
Return the vector of unweighted data points \(y\).
Definition at line 92 of file Likelihood.h.
|
inline |
Return the vector of per-data-point variances.
Definition at line 102 of file Likelihood.h.
|
inline |
Return the vector of weights \(w\) applied to data points and model matrix rows.
Will be an empty array if no weights are applied.
Definition at line 99 of file Likelihood.h.
|
delete |
|
delete |
|
protected |
Definition at line 149 of file Likelihood.h.
|
protected |
Definition at line 148 of file Likelihood.h.
|
protected |
Definition at line 147 of file Likelihood.h.
|
protected |
Definition at line 150 of file Likelihood.h.
|
protected |
Definition at line 151 of file Likelihood.h.
|
protected |
Definition at line 152 of file Likelihood.h.