Closed matthew-mcateer closed 5 years ago
Hey @CamDavidsonPilon , Here is the PR for Chapter 4 of Tensorflow Probability. In addition to the code changes, we also changed the formatting on the headers a little bit, since the way that the header heirarchies showed up in colab was a little odd. This new method also seems more intuitive.
As soon as this is approved by you, Chapter 2 can be uploaded. We're still reviewing it, but we believe that Chapter should be ready by tonight or tomorrow. How does that sound? The other chapters are also almost ready, they're still just being reviewed.
Average height vs. County Population
The code that produces this graph is quite slow - lots of time spent creating tf variables. Any way to make that faster?
Other than that, everything runs fine (except the google colab part...)
@CamDavidsonPilon yes there is a way to make it faster. I'm fixing that as we speak.
What do you mean "except the google colab part..."?
Hi @CamDavidsonPilon
in response to your point about one of the cells taking a long time, would you prefer if the cells in all our notebooks included the %time magic at the top of the cells? This way users could see exactly how much time an output takes to get there.
For example, with the following code snippet:
%time
N = 10000
print("Probability Estimate: ", len(np.where(evaluate(tfd.Exponential(rate=0.5).sample(sample_shape=N)) > 5))/N )
The output would be the following:
CPU times: user 4 µs, sys: 1 µs, total: 5 µs
Wall time: 9.54 µs
Probability Estimate: 0.0001
Okay @CamDavidsonPilon, The cell in question has been updated. It's much faster, though keep in mind it's still sampling 4000000 times. It should be much more manageable now. Was that your only concern?
Yup, all good - merging!
Added a notebook with a complete rewrite of Chapter 4 using Tensorflow Probability instead of Pymc3 or pymc2. Also reduced the amount of numpy and scipy usage.