Skip to content

Commit 2dfdb27

Browse files
authored
fix broken cell
Code was broken before, this enables the cell to be run. Fixed some typos and added "None" to the function "make_simple_step_size_update_policy()" for the argument "num_adaption_steps", which otherwise returned the error: make_simple_step_size_update_policy() missing 1 required positional argument: 'num_adaptation_steps'. As per documentation, None may not be the best choice.
1 parent c6b104e commit 2dfdb27

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Chapter1_Introduction/Ch1_Introduction_TFP.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,7 +1208,7 @@
12081208
"# Set the chain's start state.\n",
12091209
"initial_chain_state = [\n",
12101210
" tf.cast(tf.reduce_mean(count_data), tf.float32) * tf.ones([], dtype=tf.float32, name=\"init_lambda1\"),\n",
1211-
" tf.cast(tf.reduce_mean(count_data), tf.float32) * tf.ones([], dtype=tf.float32, name=\"init_lambda2\", tf.float32),\n",
1211+
" tf.cast(tf.reduce_mean(count_data), tf.float32) * tf.ones([], dtype=tf.float32, name=\"init_lambda2\"),\n",
12121212
" 0.5 * tf.ones([], dtype=tf.float32, name=\"init_tau\"),\n",
12131213
"]\n",
12141214
"\n",
@@ -1273,11 +1273,11 @@
12731273
" target_log_prob_fn=unnormalized_log_posterior,\n",
12741274
" num_leapfrog_steps=2,\n",
12751275
" step_size=step_size,\n",
1276-
" step_size_update_fn=tfp.mcmc.make_simple_step_size_update_policy(),\n",
1276+
" step_size_update_fn=tfp.mcmc.make_simple_step_size_update_policy(None),\n",
12771277
" state_gradients_are_stopped=True),\n",
12781278
" bijector=unconstraining_bijectors))\n",
12791279
"\n",
1280-
"tau_samples = tf.floor(posterior_tau * tf.cast(tf.size(count_data)), tf.float32)\n",
1280+
"tau_samples = tf.floor(posterior_tau * tf.cast(tf.size(count_data), tf.float32))\n",
12811281
"\n",
12821282
"# tau_samples, lambda_1_samples, lambda_2_samples contain\n",
12831283
"# N samples from the corresponding posterior distribution\n",

0 commit comments

Comments
 (0)