Reduced Order Modeling for Inverse Problems
Base class implementing Reduced-Order approximation of the Hessian of the negative-log-posterior function in DA.i |
|
|
Reduced-Order Approximation of the Hessian (of the posterior negative-log) using standard Singular Value Decomposition. |
|
An implementation that enables creating randomized approximation for a forward model once, and thus enable reutilizing it efficiently |
This utility mnodule provides implementations to aid in reducing the computaitonal cost of solving data assimilation and inverse problems. This includes, reduced order modeling and randmization for matrix-vector approximations, etc.
- class NystromRandomizedHessian(inverse_problem, rank_p=20, over_sampling=15, data_misfit_only=True, random_seed=None, verbose=False)[source]
Bases:
ReducedHessian
,RandomNumberGenerationMixin
An implementation that enables creating randomized approximation for a forward model once, and thus enable reutilizing it efficiently
- Parameters:
inverse_problem – the inverse problem to use (a variational filter or smoother) e.g., a 4D-Var smoother instance
rank_p (int) – requested rank of the reduced order Hessian approximation
over_sampling (int) –
data_misfit_only (bool) –
verbose (bool) – flag to control screen output verbosity
- Returns:
an instance of
NystromRandomizedHessian
- Hessian_inv_matvec(state, eval_at=None, data_misfit_only=None, verbose=False)
- Return the product of the Inverse of the Reduced-Hessian-Approxmiation of 4D-Var objective
(inverse of posterior covariance) with a vector ‘state’.
- Hessian_matvec(state, eval_at=None, data_misfit_only=False, verbose=False)
- Return the product of the Randomized-Hessian-Approxmiation of 4D-Var objective
(inverse of posterior covariance) with a vector ‘state’. Here, we use a two-pass algorithm for GN-Hessian approximation
- Parameters:
state – initial state/guess of the model state/parameter
eval_at – state at which the Hessian is evaluated (passed to the model adjoint)
data_misfit_only (bool) – if True the prior term of the Hessian is discarded, and only the data-misfit term is evaluated
verbose (bool) – flag to control screen output verbosity
- Returns:
estimate of the product of the inverse of the posterior covariance (of the linearized problem) with a state vector
- __init__(inverse_problem, rank_p=20, over_sampling=15, data_misfit_only=True, random_seed=None, verbose=False)[source]
- array(eval_at=None, data_misfit_only=False, verbose=False)[source]
Construct an array repersentatiton of the reduced Hessian
- array_inverse(eval_at=None, data_misfit_only=False, verbose=False)[source]
Construct an array repersentatiton of the reduced Hessian
- property data_misfit_only
Evaluate the data-misfit term of the Hessian only
- initialize()[source]
Use the associated settings to generate/update the randomized approximation of the Hessian
- inv_matvec(state, eval_at=None, data_misfit_only=None, verbose=False)[source]
- Return the product of the Inverse of the Reduced-Hessian-Approxmiation of 4D-Var objective
(inverse of posterior covariance) with a vector ‘state’.
- property inverse_problem
Pointer to the underlying inverse_problem (which gives access to all other elements; model, error models, observation operator, etc.)
- matvec(state, eval_at=None, data_misfit_only=False, verbose=False)[source]
- Return the product of the Randomized-Hessian-Approxmiation of 4D-Var objective
(inverse of posterior covariance) with a vector ‘state’. Here, we use a two-pass algorithm for GN-Hessian approximation
- Parameters:
state – initial state/guess of the model state/parameter
eval_at – state at which the Hessian is evaluated (passed to the model adjoint)
data_misfit_only (bool) – if True the prior term of the Hessian is discarded, and only the data-misfit term is evaluated
verbose (bool) – flag to control screen output verbosity
- Returns:
estimate of the product of the inverse of the posterior covariance (of the linearized problem) with a state vector
- property over_sampling
- property rank_p
- property verbose
Evaluate the data-misfit term of the Hessian only
- class ReducedHessian[source]
Bases:
ABC
Base class implementing Reduced-Order approximation of the Hessian of the negative-log-posterior function in DA.i
- class SVDReducedHessian(inverse_problem, rank_p=50, data_misfit_only=False, eval_at=None, random_seed=None, verbose=False)[source]
Bases:
ReducedHessian
,RandomNumberGenerationMixin
Reduced-Order Approximation of the Hessian (of the posterior negative-log) using standard Singular Value Decomposition. This can be used to speed up inverse applications, but it still is expensive to carry out. Yet, it is valid for Hessian with singular values those do not decay quickly.
- Parameters:
inverse_problem – the inverse problem to use (a variational filter or smoother) e.g., a 4D-Var smoother instance
rank_p (int) – requested rank of the reduced order Hessian approximation (Number of singular values to keep.) If None, all singular values are kept (Full Hessian).
data_misfit_only (bool) –
eval_at – point to approximate/linearize the Hessian at (optional; discarded for linear problems)
verbose (bool) – flag to control screen output verbosity
- Returns:
an instance of
NystromRandomizedHessian
- Hessian_inv_matvec(state, eval_at=None, data_misfit_only=None, verbose=False)
- Return the product of the Inverse of the Reduced-Hessian-Approxmiation of 4D-Var objective
(inverse of posterior covariance) with a vector ‘state’.
- Hessian_matvec(state, eval_at=None, data_misfit_only=None, verbose=False)
- Return the product of the Reduced-Hessian-Approxmiation of 4D-Var objective
(inverse of posterior covariance) with a vector ‘state’.
- Parameters:
state – initial state/guess of the model state/parameter
eval_at – state at which the Hessian is evaluated (passed to the model adjoint)
data_misfit_only (bool) – if True the prior term of the Hessian is discarded, and only the data-misfit term is evaluated
verbose (bool) – flag to control screen output verbosity
- Returns:
estimate of the product of the inverse of the posterior covariance (of the linearized problem) with a state vector
- __init__(inverse_problem, rank_p=50, data_misfit_only=False, eval_at=None, random_seed=None, verbose=False)[source]
- apply(state, eval_at=None, data_misfit_only=None, verbose=False)
- Return the product of the Reduced-Hessian-Approxmiation of 4D-Var objective
(inverse of posterior covariance) with a vector ‘state’.
- Parameters:
state – initial state/guess of the model state/parameter
eval_at – state at which the Hessian is evaluated (passed to the model adjoint)
data_misfit_only (bool) – if True the prior term of the Hessian is discarded, and only the data-misfit term is evaluated
verbose (bool) – flag to control screen output verbosity
- Returns:
estimate of the product of the inverse of the posterior covariance (of the linearized problem) with a state vector
- array(eval_at=None, data_misfit_only=False, verbose=False)[source]
Construct an array repersentatiton of the reduced Hessian
- array_inverse(eval_at=None, data_misfit_only=False, verbose=False)[source]
Construct an array repersentatiton of the reduced Hessian
- property data_misfit_only
Evaluate the data-misfit term of the Hessian only
- initialize(Hessian_matvec=None, eval_at=None, data_misfit_only=None, verbose=False)[source]
Use the associated settings to generate/update the POD reduced-order approximation of the Hessian All the arguments here are optional, and if not explicitly provided, are replaced with internal values set upon initilization (or if modified explicitly) check properties
- Parameters:
Hessian_matvec –
eval_at –
data_misfit_only –
- inv_matvec(state, eval_at=None, data_misfit_only=None, verbose=False)[source]
- Return the product of the Inverse of the Reduced-Hessian-Approxmiation of 4D-Var objective
(inverse of posterior covariance) with a vector ‘state’.
- property inverse_problem
Pointer to the underlying inverse_problem (which gives access to all other elements; model, error models, observation operator, etc.)
- property linearize_at
- matvec(state, eval_at=None, data_misfit_only=None, verbose=False)[source]
- Return the product of the Reduced-Hessian-Approxmiation of 4D-Var objective
(inverse of posterior covariance) with a vector ‘state’.
- Parameters:
state – initial state/guess of the model state/parameter
eval_at – state at which the Hessian is evaluated (passed to the model adjoint)
data_misfit_only (bool) – if True the prior term of the Hessian is discarded, and only the data-misfit term is evaluated
verbose (bool) – flag to control screen output verbosity
- Returns:
estimate of the product of the inverse of the posterior covariance (of the linearized problem) with a state vector
- property rank_p
- property state_size
- test_accuracy(sample_size=10, verbose=False, test_inverse_Hessian=True)[source]
Test the accuracy of the constructed reduced-order Hessian approximation 1- Generate random vectors and evaluate Hessian matvec and Hessian inv matvec (both full and reduced order approxiamtion) 2- show infinity norm of the difference magnitude;
By default, this function tests the accuracy of the Hessian-inverse matrix vector product. set test_inverse_Hessian to test Hessian instead of the inverse
- property verbose
Evaluate the data-misfit term of the Hessian only