Poisson1D#
- class cuqi.testproblem.Poisson1D(dim=128, endpoint=1, source=<function Poisson1D.<lambda>>, field_type=None, field_params=None, map=None, imap=None, SNR=200, observation_grid_map=None, exactSolution=None)#
1D Poisson test problem. Discretized 1D Poisson equation (steady-state linear PDE).
- Parameters:
dim (int) –
size of the grid for the poisson problemendpoint (float) –
Location of end-point of grid.source (lambda function) –
Function for source term.field_type (str or cuqi.geometry.Geometry) –
Field type of domain. The accepted values are:a Geometry object.”KL”: acuqi.geometry.KLExpansion
geometry object will be created and set as a domain geometry.”KL_Full”: acuqi.geometry.KLExpansion_Full
geometry object will be created and set as a domain geometry.”Step”: acuqi.geometry.StepExpansion
geometry object will be created and set as a domain geometry.”CustomKL”: acuqi.geometry.CustomKL
geometry object will be created and set as a domain geometry.None: acuqi.geometry.Continuous1D
geometry object will be created and set as a domain geometry.field_params (dict) –
A dictionary of key word arguments that the underlying geometry accepts. (Passed to the underlying geometry when field type is KL, KL_Full, CustomKL, Step). For example, for Step field type, the dictionary can be {“n_steps”: 3}.map (lambda function) –
Mapping used to modify field.imap (lambda function) –
Inverse of KL map.SNR (int) –
Signal-to-noise ratio
- observation_grid_maplambda function
- Function that takes the grid as input and returns a sub-grid of the nodes where observations are available, e.g. observation_grid_map = lambda x: x[np.where(x>5.0)].
- data#
Generated (noisy) data
- Type:
ndarray
- model#
Poisson 1D model
- Type:
- prior#
Distribution of the prior
- likelihood#
Likelihood function
- exactSolution#
Exact solution (ground truth)
- Type:
ndarray
- exactData#
Noise free data
- Type:
ndarray
- MAP()#
Compute MAP estimate of posterior. NB: Requires prior to be defined.
- sample_posterior(Ns)#
Sample Ns samples of the posterior. NB: Requires prior to be defined.
- __init__(dim=128, endpoint=1, source=<function Poisson1D.<lambda>>, field_type=None, field_params=None, map=None, imap=None, SNR=200, observation_grid_map=None, exactSolution=None)#
Methods
MAP
([disp, x0])Compute the Maximum A Posteriori (MAP) estimate of the posterior.
ML
([disp, x0])Compute the Maximum Likelihood (ML) estimate of the posterior.
UQ
([Ns, Nb, percent, exact, experimental])Run an Uncertainty Quantification (UQ) analysis on the Bayesian problem and provide a summary of the results.
__init__
([dim, endpoint, source, ...])Method that returns the model, the data and additional information to be used in formulating the Bayesian problem.
sample_posterior
(Ns[, Nb, callback, ...])Sample the posterior.
sample_prior
(Ns[, callback])Sample the prior distribution.
set_data
(**kwargs)Set the data of the problem.
Attributes
Extract the observed data from likelihood
The likelihood function.
Extract the cuqi model from likelihood.
Create posterior distribution from likelihood and prior.
The prior distribution