tensorflow / tensorflow/probability

AttributeError: tfp.jax.vi has no attribute 'build_factored_surrogate_posterior'

Open
#1,646 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Jupyter Notebook
Stars
4.4k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

When running the code in the following blog

https://github.com/tensorflow/probability/blob/main/tensorflow_probability/examples/jupyter_notebooks/Structural_Time_Series_Modeling_Case_Studies_Atmospheric_CO2_and_Electricity_Demand.ipynb

and replace tfp with tfp.substrates.jax. The code fails in the step:

variational_posteriors = tfp.sts.build_factored_surrogate_posterior(
model=co2_model)

Error message:

AttributeError: module 'tensorflow_probability.substrates.jax.experimental.vi' has no attribute 'build_factored_surrogate_posterior'

Since variational inference is also used to initialize the hmc sampler, this error also fails the sts.fit_hmc() function.

@murphyk

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Structural_Time_Series_Modeling_Case_Studies_Atmospheric_CO2_and_Electricity_Demand.ipynb linked in the issue and reproduce the failing tfp.substrates.jax call to tfp.sts.build_factored_surrogate_posterior. Compare the TensorFlow and JAX paths, then verify that variational initialization works and sts.fit_hmc() no longer fails.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter-notebook
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.