Skip to content

TST: test all rvs, not just tfp supported distributions #54

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

Merged
merged 15 commits into from
Feb 4, 2019

Conversation

eigenfoo
Copy link
Member

@eigenfoo eigenfoo commented Jan 19, 2019

Closes #52

Building off of #49, this PR adds tests for all current distributions, not just those supported by tfp.

@eigenfoo eigenfoo added the WIP Work in progress label Jan 19, 2019
@eigenfoo eigenfoo self-assigned this Jan 19, 2019
@coveralls
Copy link

Pull Request Test Coverage Report for Build 170

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at ?%

Totals Coverage Status
Change from base Build 168: 0.0%
Covered Lines:
Relevant Lines: 0

💛 - Coveralls

@eigenfoo
Copy link
Member Author

Well this caught a few bugs, mostly to do with using the wrong dtype (e.g. tf.float32 instead of tf.float64). I'll try and debug this sometime this weekend.

@canyon289 is it possible to get Coveralls to not comment like that? With PyMC3 it would should up in the same place that the Travis CI is.

@twiecki
Copy link
Member

twiecki commented Jan 19, 2019

Disabled coverall comments.

@canyon289
Copy link
Member

canyon289 commented Jan 19, 2019

I think we need to split apart the tests for the tfp implemented distributions from the ones that pymc4 implements because for the pymc4 implemented distributions we do need to check for correctness, not just compilation

@twiecki
Copy link
Member

twiecki commented Jan 20, 2019

@canyon289 I think we can keep these here but make sure we also add correctness tests in addition.

@eigenfoo
Copy link
Member Author

eigenfoo commented Feb 4, 2019

Currently the following code snippet fails with a NotImplementedError for the inverse_log_det_jacobian, in bijector.py. I propose we just comment out the DiscreteUniform distribution (and its tests) until tfp implements the relevant functions. I'm working on making sure the other distributions are suitably tested.

In [1]: import tensorflow_probability as tfp
   ...: from tensorflow_probability import distributions as tfd
   ...:
   ...: x = tfd.TransformedDistribution(distribution=tfd.Categorical(probs=[0.5, 0.5]),
   ...:                                 bijector=tfp.bijectors.AffineScalar(shift=1),
   ...:                                 name='DiscreteUniform')
   ...:
   ...: x.log_prob(2)

@eigenfoo eigenfoo removed the WIP Work in progress label Feb 4, 2019
@eigenfoo eigenfoo requested a review from canyon289 February 4, 2019 04:23
@eigenfoo
Copy link
Member Author

eigenfoo commented Feb 4, 2019

(Finally) ready for review.

I excluded the ZeroInflatedBinomial distribution from the regular tests for the same reason @canyon289 excluded the Binomial distribution: there's an upstream problem with tfp.

I've also commented out the DiscreteUniform distribution, and added TODOs at the appropriate places, as discussed above.

@twiecki
Copy link
Member

twiecki commented Feb 4, 2019

Looks great, thanks!

We should open an issue with TFP about the problems we found.

@twiecki twiecki merged commit 1f5ae18 into master Feb 4, 2019
@twiecki twiecki deleted the test-tfp-unsupported branch February 4, 2019 07:45
@eigenfoo
Copy link
Member Author

eigenfoo commented Feb 4, 2019

TFP issue filed here: tensorflow/probability#286

@twiecki
Copy link
Member

twiecki commented Feb 5, 2019

Nice, looks like there is a simple solution available.

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.

4 participants