fips.estimators#
Inversion estimators.
This module contains various inversion estimators for solving inverse problems.
Classes
|
Bayesian inversion estimator class This class implements a Bayesian inversion framework for solving inverse problems, also known as the batch method. |
|
Base inversion estimator class. |
Registry for estimator classes. |
- class fips.estimators.Estimator(z, x_0, H, S_0, S_z, c=None)[source]#
Base inversion estimator class.
- z#
Observed data.
- Type:
np.ndarray
- x_0#
Prior model state estimate.
- Type:
np.ndarray
- H#
Forward operator.
- Type:
np.ndarray
- S_0#
Prior error covariance.
- Type:
np.ndarray
- S_z#
Model-data mismatch covariance.
- Type:
np.ndarray
- x_hat#
Posterior mean model state estimate (solution).
- Type:
np.ndarray
- S_hat#
Posterior error covariance.
- Type:
np.ndarray
- y_hat#
Posterior modeled observations.
- Type:
np.ndarray
- y_0#
Prior modeled observations.
- Type:
np.ndarray
- K#
Kalman gain.
- Type:
np.ndarray
- A#
Averaging kernel.
- Type:
np.ndarray
- U_red#
Reduced uncertainty.
- Type:
np.ndarray
- __init__(z, x_0, H, S_0, S_z, c=None)[source]#
Initialize the Estimator object.
- Parameters:
z (np.ndarray) – Observed data.
x_0 (np.ndarray) – Prior model state estimate.
H (np.ndarray) – Forward operator.
S_0 (np.ndarray) – Prior error covariance.
S_z (np.ndarray) – Model-data mismatch covariance.
c (np.ndarray or float, optional) – Constant data, defaults to 0.0.
- forward(x)[source]#
Forward model calculation.
\[y = Hx + c\]- Parameters:
x (np.ndarray) – State vector.
- Returns:
Model output (Hx + c).
- Return type:
np.ndarray
- residual(x)[source]#
Forward model residual.
\[r = z - (Hx + c)\]- Parameters:
x (np.ndarray) – State vector.
- Returns:
Residual (z - (Hx + c)).
- Return type:
np.ndarray
- leverage(x)[source]#
Calculate the leverage matrix.
Which observations are likely to have more impact on the solution.
\[L = Hx ((Hx)^T (H S_0 H^T + S_z)^{-1} Hx)^{-1} (Hx)^T (H S_0 H^T + S_z)^{-1}\]- Parameters:
x (np.ndarray) – State vector.
- Returns:
Leverage matrix.
- Return type:
np.ndarray
- abstract cost(x)[source]#
Cost/loss/misfit function.
- Parameters:
x (np.ndarray) – State vector.
- Returns:
Cost value.
- Return type:
- abstract property x_hat: ndarray#
Posterior mean model state estimate (solution).
- Returns:
Posterior state estimate.
- Return type:
np.ndarray
- abstract property S_hat: ndarray#
Posterior error covariance matrix.
- Returns:
Posterior error covariance matrix.
- Return type:
np.ndarray
- property y_hat: ndarray#
Posterior mean observation estimate.
\[\hat{y} = H \hat{x} + c\]- Returns:
Posterior observation estimate.
- Return type:
np.ndarray
- property y_0: ndarray#
Prior mean data estimate.
\[\hat{y}_0 = H x_0 + c\]- Returns:
Prior data estimate.
- Return type:
np.ndarray
- property K#
Kalman gain matrix.
\[K = (H S_0)^T (H S_0 H^T + S_z)^{-1}\]- Returns:
Kalman gain matrix.
- Return type:
np.ndarray
- property A#
Averaging kernel matrix.
\[A = KH = (H S_0)^T (H S_0 H^T + S_z)^{-1} H\]- Returns:
Averaging kernel matrix.
- Return type:
np.ndarray
- property DOFS: float#
Degrees Of Freedom for Signal (DOFS).
\[DOFS = Tr(A)\]- Returns:
Degrees of Freedom value.
- Return type:
- property reduced_chi2: float#
Reduced Chi-squared statistic. Tarantola (1987)
\[\chi^2 = \frac{1}{n_z} ((z - H\hat{x})^T S_z^{-1} (z - H\hat{x}) + (\hat{x} - x_0)^T S_0^{-1} (\hat{x} - x_0))\]Note
I can’t find a copy of Tarantola (1987) to verify this equation, but it appears in Kunik et al. (2019) https://doi.org/10.1525/elementa.375
- Returns:
Reduced Chi-squared value.
- Return type:
- property R2: float#
Coefficient of determination (R-squared).
\[R^2 = corr(z, H\hat{x})^2\]- Returns:
R-squared value.
- Return type:
- class fips.estimators.BayesianSolver(z, x_0, H, S_0, S_z, c=None, rf=1.0)[source]#
Bayesian inversion estimator class This class implements a Bayesian inversion framework for solving inverse problems, also known as the batch method.
- __init__(z, x_0, H, S_0, S_z, c=None, rf=1.0)[source]#
Initialize inversion object
- Parameters:
z (np.ndarray) – Observed data
x_0 (np.ndarray) – Prior model estimate
H (np.ndarray) – Forward operator
S_0 (np.ndarray) – Prior error covariance
S_z (np.ndarray) – Model-data mismatch covariance
c (np.ndarray | float, optional) – Constant data, defaults to 0.0
rf (float, optional) – Regularization factor, by default 1.0
- cost(x)[source]#
Cost function
\[J(x) = \frac{1}{2}(x - x_0)^T S_0^{-1}(x - x_0) + \frac{1}{2}(z - Hx - c)^T S_z^{-1}(z - Hx - c)\]
- property x_hat#
Posterior Mean Model Estimate (solution)
\[\hat{x} = x_0 + K(z - Hx_0 - c)\]
- property S_hat#
Posterior Error Covariance Matrix
\[\hat{S} = (H^T S_z^{-1} H + S_0^{-1})^{-1} = S_0 - (H S_0)^T(H S_0 H^T + S_z)^{-1}(H S_0)\]