CamDavidsonPilon / Probabilistic-Programming-and-Bayesian-Methods-for-Hackers

aka "Bayesian Methods for Hackers": An introduction to Bayesian methods + probabilistic programming with a computation/understanding-first, mathematics-second point of view. All in pure Python ;)
http://camdavidsonpilon.github.io/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers/
MIT License
26.72k stars 7.88k forks source link

Chapter 2 TFP. make_simple_step_size_update_policy requires positional argument (doesn't run on colab) #446

Open Liviodl opened 5 years ago

Liviodl commented 5 years ago

Running from colab. The TFP make_simple_step_size_update_policy requires a positional argument. Providing a value for the parameter "num_adaptation_steps:, produces different errors.

Here is the original error message.

WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/resource_variable_ops.py:435: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version. Instructions for updating: Colocations handled automatically by placer.

TypeError Traceback (most recent call last)

in () 39 num_leapfrog_steps=leapfrog_steps, 40 step_size=step_size, ---> 41 step_size_update_fn=tfp.mcmc.make_simple_step_size_update_policy(), 42 state_gradients_are_stopped=True), 43 bijector=unconstraining_bijectors) TypeError: make_simple_step_size_update_policy() missing 1 required positional argument: 'num_adaptation_steps'
hrbzkm98 commented 5 years ago

Run into same issue here in Google Colab. Which Tensorflow Probability Version is this code written in?

Liviodl commented 5 years ago

I was running the code in colab too. the tfp version is 0.6.0

hrbzkm98 commented 5 years ago

Attempt to leave the param 'num_adaptation_steps' to None. It runs forever.

cmh325 commented 5 years ago

Works when you set it to None in chapter 3. Did not work for chapter 2.

nrakocz commented 5 years ago

Same issue on my mac. tfp 0.6.0.

austinbrian commented 5 years ago

I used the following parameters, based on the official TF documentation here, which ran in a reasonable minute or two:

            step_size_update_fn=tfp.mcmc.make_simple_step_size_update_policy(
                num_adaptation_steps=10, # chosen arbitrarily
                target_rate=0.75,
                decrement_multiplier=0.1, # increased from 0.01 to speed execution
                increment_multiplier=0.1, 
                step_counter=None),

There are very likely some better parameters to use, but this will get you through the chapter.