Laplace Inference

bvas.laplace.laplace_inference(Y, Gamma, mutations, coef_scale=0.01, seed=0, num_steps=10000, log_every=500, init_lr=0.01)[source]

Use Maximum A Posteriori (MAP) inference and a diffusion-based likelihood in conjunction with a sparsity-inducing Laplace prior on selection coefficients to infer selection effects from genomic surveillance data.

Unlike most of the code in this repository, laplace_inference depends on Pyro.

Parameters:
  • Y (torch.Tensor) – A vector of shape (A,) that encodes integrated alelle frequency increments for each allele and where A is the number of alleles.

  • Gamma (torch.Tensor) – A matrix of shape (A, A) that encodes information about second moments of allele frequencies.

  • mutations (list) – A list of strings of length A that encodes the names of the A alleles in Y.

  • coef_scale (float) – The regularization scale of the Laplace prior. Defaults to 0.01.

  • seed (int) – Random number seed for reproducibility.

  • num_steps (int) – The number of optimization steps to do. Defaults to 10000.

  • log_every (int) – Controls logging frequency. Defaults to 500.

  • init_lr (float) – The initial learning rate. Defaults to 0.01.

Returns pandas.DataFrame:

Returns a pandas.DataFrame containing results of inference.