Skip to content

Bayesian Structural Time Series - Code adjusments #207

Description

@gustavodemari

Chapter 06,
Section 6.4.3 Bayesian Structural Time Series

I was trying to run some code available on https://bayesiancomputationbook.com/markdown/chp_06.html#bayesian-structural-time-series, but it was giving me some errors. Then, I checked the jupyter notebook on this repo and found that the code on site has some differences from the jupyter notebook.

I've listed below some differences that I've found, maybe it is just updating the site to reflect the code on ch06.ipynb

The line below is on ch06.ipynb, but isn't on the site version.

birth_model_jd = birth_model.joint_distribution(observed_time_series=observed)

image

The code block 6.27, below, has been updated on ch06.ipynb, but isn't on the site version.

Site:

# Using a subset of posterior samples.
parameter_samples = [x[-100:, 0, ...] for x in mcmc_samples]

Ch06.ipynb

# Using a subset of posterior samples.
parameter_samples = tf.nest.map_structure(lambda x: x[-100:, 0, ...], mcmc_samples)

Also, one important line to run the code isn't on the site. Maybe it is good to show it in some code block on the site too.

mcmc_samples, sampler_stats = run_mcmc(
    1000, birth_model_jd, n_chains=4, num_adaptation_steps=1000,
    seed=tf.constant([745678, 562345], dtype=tf.int32))

Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions