How to sample from low likelihood region?

Given a mean and a covariance matrix, is it possible to get sample with probability less than a threshold (e.g., p < 0.1) in PyTorch?

Something like this

gaussian = torch.distributions.MultivariateNormal(mean, cov)

samples = gaussian.sample(sample_shape=torch.Size([1000]),
                          tail_prob=0.1)

Thank you.

Hi Assefa!

I’m not aware of any built-in functionality of pytorch that will do this.

One sensible approach would be to use some variation of rejection sampling.

In your case you could sample from your gaussian, compute whether
your sample falls within your low-likelihood tail_prob region, use the
sample if it does, and reject the sample (and resample) if it doesn’t.

For tail_prob = 0.1 you will be throwing out 90% of your samples.
However, if this random sampling isn’t the computational bottleneck in
your overall workflow, this 90% inefficiency won’t really matter.

Best.

K. Frank