⚠️ Content to be extended to cover other random fields as well, possibly including FEniCS KL fields
In some cases, we may want to generate samples that represent a field with some spatial correlation and smoothness properties.
One CUQIpy distribution object that can be achieved for this purpose is the Gaussian Markov random field (GMRF) distribution siden2020scalable. This distribution assumes a Gaussian distribution on the differences between neighboring elements of , i.e. in 1D:
where we purposely leave out the details on the boundary conditions for this notebook.
To simplify the notation, we denote by the distribution that induces this property on a vector defined by its mean and precision . That is, the above can be written as
with some choice of the precision say . For more details on GMRF see the CUQIpy paper (the first part of the 2-part article) Riis_2024.
The GMRF distribution is implemented in CUQIpy as GMRF class and can be used as follows:
Notebook Cell
from cuqi.distribution import GMRF
import numpy as np# Define prior precision
d = 50
n = 200
# Define GMRF prior (zero boundary conditions are the default)
x_GMRF = GMRF(np.zeros(n), d)# your code here
Other Markov random fields in CUQIpy:¶
Cauchy Markov Random Field (CMRF): CMRF class
Laplace Markov Random Field (LMRF): LMRF class
CMRF and LMRF are similar to GMRF but with different distributions on the differences between neighboring elements in the signal, where CMRF assumes a Cauchy distribution and LMRF assumes a Laplace distribution. LMRF and CMRF are particularly useful in cases in which the signal to be inferred has sharp edges (jumps).
This 1D deconvolution example from Riis_2024 illustrates and compares using the three Markov random fields in a 1D problem.