New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add `CensoredDistribution` #1489

Open
wants to merge 4 commits into
base: dev
from

Conversation

Projects
None yet
4 participants
@ae-foster
Contributor

ae-foster commented Oct 23, 2018

We currently have TransformedDistribution which works with invertible transformations of random variables. The new CensoredDistribution, added here, makes the following non-invertible transformation

X ~ dist
X[X >= upper_lim] = upper_lim
X[X <= lower_lim] = lower_lim

The new pdf uses the log(cdf) values at upper_lim and lower_lim, and the original pdf elsewhere. This is a valid probability density function, albeit with respect to a new base measure.

These distributions find applications in contrib.oed work (they make interesting OED problems because censoring leads to lower / zero information gain)

ae-foster added some commits Oct 23, 2018

@ae-foster ae-foster force-pushed the ae-foster:censored_dist branch from e154c8b to 3444642 Oct 23, 2018

@fritzo

Can you please add some tests? It's fine to add a new file tests/distributions/test_censored.py.

def rsample(self, sample_shape=torch.Size()):
x = self.base_dist.sample(sample_shape)
x[x > self.upper_lim] = self.upper_lim
x[x < self.lower_lim] = self.lower_lim

This comment has been minimized.

@fritzo

fritzo Oct 23, 2018

Member

return x and add a test that would have caught this.

@fritzo

This comment has been minimized.

Member

fritzo commented Oct 23, 2018

cc @alicanb who prototyped TruncatedDistribution in probtorch/pytorch#121

@ae-foster

This comment has been minimized.

Contributor

ae-foster commented Oct 23, 2018

Thanks @fritzo ! I will get on and write some tests

@activatedgeek

This comment has been minimized.

activatedgeek commented Dec 6, 2018

Hey @ae-foster, can you point me to some references where Censored Distribution was required?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment