Heat1D#
- class cuqi.testproblem.Heat1D(dim=128, endpoint=1, max_time=0.2, field_type=None, field_params=None, map=None, imap=None, SNR=200, exactSolution=None, observation_grid_map=None)#
1D Heat test problem. Discretized Heat equation (time-dependent linear PDE).
- Parameters:
dim (int) –
size of the grid for the heat problemendpoint (float) –
Location of end-point of grid.max_time (float) –
The last time step.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) –
If given, an underlying MappedGeometry geometry object is created which applies the mapping on the field, e.g. for log parameterization: map = lambda x:np.exp(x).imap (lambda function) –
The inverse of the provided map.SNR (int) –
Signal-to-noise ratioexactSolution (ndarray or CUQIarray) –
The exact solution of the problem which is the heat model initial condition in this test problem. If provided as None, an exact solution is generated, if provided as ndarray, it is assumed to be function values and it is converted to a CUQIarray.
- 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#
Heat 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, max_time=0.2, field_type=None, field_params=None, map=None, imap=None, SNR=200, exactSolution=None, observation_grid_map=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, max_time, ...])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