tensorflow / tensorflow/probability

Custom Mean And Covariance for Variational Candidate in BNN example

Open
#985 2 comments 0 reactions 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

Hi There,

What would be the best way to access the mean and the covariance of the variational posterior distribution in the bayesian_neural_network.py example?

Everything is happening under the hood in model.train_on_batch where the optimizer (no matter which) computes those hyperparameters (parameters of the Gaussian variational candidate) using a descent step after computing a Monte Carlo (Flipout) approximation of the loss function (embedded in the layers of the model + cross-entropy).

This latter MC approximation requires sampling from the variational candidate with the current values of the hyperparameters: That's where I would like to have access to, in order to change those hyperparameters value.

I could do it in a customer optimizer but was wondering if an easier way could be to do the changes right before the sampling step.

Thanks a lot.
Belhal

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 bayesian_neural_network.py example and the model.train_on_batch flow described in the issue. Trace where the variational candidate is sampled and how its mean and covariance are represented, then determine the access point needed to change them before sampling. Done means the example can access and modify those parameters without requiring a custom optimizer.

Written by the indexing model from the issue text.

Assessment

Tech stack
tensorflow
Domain
machine-learning
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 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.