Likelihood for new samples from empirical distribution

Is there a way to compute likelihood of a new sample using the Empirical distribution?
Example:

import torch
from pyro.distributions import empirical

samples = torch.randn(100, 5)
emp_dist = empirical.Empirical(samples, torch.ones(100))
new_observation = torch.randn(5)
emp_dist.log_prob(new_observation)

Currently this code outputs -inf. I assume because the new observation is not in the samples used to create the distribution.

I’m basically looking for a way to score the “in-distribution-ness” of the new_observation.
Any suggestions are appreciated.

this can’t be done without further assumptions. if your samples are low-dimensional enough a standard way to do this might be with a kernel density estimate.

1 Like