Skip to content
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

🐛 Test was failling due to sampling. #11

Closed

Conversation

davibarreira
Copy link
Member

The current test returns an error in the "1D continuous case". The problem is that the sample used to evaluate the transport plan is taken from a Normal(0,1) while the acutal mu and nu distributions are something like Normal(-0.6,1), so when calculating the cdf(\mu, x), it actually returns Inf, and thus becoming incomparable to \gamma.

I fixed to sample from mu instead, to avoid such distant value. Also, I did multiple sampling to provide a more robust test.

@devmotion
Copy link
Member

The problem is that the sample used to evaluate the transport plan is taken from a Normal(0,1) while the acutal mu and nu distributions are something like Normal(-0.6,1), so when calculating the cdf(\mu, x), it actually returns Inf,

I can't follow, why would it ever return Inf? 0 <= cdf(\mu, x) <= 1, regardless of x.

@davibarreira
Copy link
Member Author

davibarreira commented Oct 28, 2021

Sorry, not cdf(mu,x) returns Inf, but quantile(nu, cdf(mu,x)). Since x is so far from mu, one gets cdf(mu,x) =1, and then quantile(nu, cdf(mu,x)) = Inf.

@devmotion
Copy link
Member

Maybe just perform computations in log-space? This should be more stable anyways. I.e., use invlogcdf(nu, logcdf(mu, x)).

@davibarreira
Copy link
Member Author

Just tried, but it didn't solve the issue. What's the problem of sampling from mu as I have coded?

@devmotion
Copy link
Member

I think it would be nice if we don't have to use our knowledge about mu. Nevertheless computations in log space are better.

I opened another PR with some additional fixes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants