Skip to content

Variational Bayes for the time-domain NMR model

License

Notifications You must be signed in to change notification settings

geekysuavo/vbnmr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Variational Bayes for NMR

A framework for approximate Bayesian inference from off-grid, non-uniformly, non-simultaneously sampled multidimensional NMR data.

The vbnmr library extends the variational feature learning library with a quad factor type and a vfgp model type. The quad factor encodes multidimensional multicomplex quadrature cosines, which are a fundamental component of the NMR signal model. The vfgp model type was originally used for active learning, but this has been superseded by the GPU-assisted search structure in VFL.

While the quadrature factor is suited for both on-grid and off-grid learning via gradient-based optimization, it also supports fast mean-field inference when the data lie on an integer grid.

Introduction

In short, vbnmr extends VFL to support parameteric models of the kind introduced by G. L. Bretthorst, R. Chylla, and J. L. Markley. Thus, we directly obtain an engine for parameter inference (via fixed-form variational Bayes), in the NMR signal model.

Modeling NMR data

In the simplest possible case, we may treat the NMR signal as a sum of decaying multicomplex quadrature sinusoids. In most cases, we have a good prior estimates of:

  • Number of signals (specified as a count, M)
  • Measurement noise (specified a precision, tau)
  • Signal-to-noise ratio (specified as a power ratio, nu)

In addition, we should have more-or-less decent prior estimates of:

  • Mean and variance of decay rates (specified via A and B)
  • Mean and variance of signal frequencies (specified via U and T)

This state of knowledge may be represented in vflang as follows:

dat = data();
# ... fill the dataset with measurements ...
mdl = tauvfr(
  tau: tau, nu: nu, data: dat,
  factors: M * [decay(alpha: A, beta: B, fixed: true) *
                quad(mu: U, tau: T, ftsize: 65536)]
);

The keen observer will notice that we have fixed the decay factor and specified the ftsize property of each quadrature factor. Doing so enables the use of fast mean-field inference when the data lie on an integer grid:

opt = mf(model: mdl, maxIters: 1);
opt.execute();

If required, we can then perform full inference using natural gradient ascent over all the factor parameters:

for j in std.range(n: mdl.M) {
  mdl.factors[j][0].fixed = false; # un-fix each decay factor.
}
opt = fg(model: mdl); # run natural gradient optimization.
opt.execute();

The above vflang is a small taste of the possible methods of inference using the vbnmr extension to vfl. More complete documentation will be made available in the near future.

Installation

The vbnmr library is written in C99-compliant source code (with GNU extensions). The FFTW library is required for compilation.

You can compile and install vbnmr as follows:

git clone git://github.com/geekysuavo/vbnmr.git
cd vbnmr
make
sudo make install

Following installation, vbnmr can be used by inclusion as a shared library in C programs, or by importing it as a module into vflang scripts.

Licensing

The vbnmr library is released under the MIT license. See the LICENSE.md file for the complete license terms.