tensorflow / tensorflow/probability

Is reparameterization not available for Mixture MultivariateNormalDiag using MixtureSameFamily?

Open
#1,548 1 comment 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

Trying to sample from a mixture multivariate normal distribution using reparameterization trick, however errors return.

import tensorflow_probability as tfp
tfd = tfp.distributions

gm = tfd.MixtureSameFamily(
      mixture_distribution=tfd.Categorical(
          probs=[0.3, 0.7]),
      components_distribution=tfd.MultivariateNormalDiag(
          loc=[[-1., 1],  # component 1
               [1, -1]],  # component 2
          scale_identity_multiplier=[.3, .6]), reparameterize=True )
sample = gm.sample()

Errors return after executing the code above:

InvalidArgumentError: `univariate_components` must have scalar event
Condition x == y did not hold.
First 1 elements of x:
[False]
First 1 elements of y:
[ True]

Is there any way to work around that?
Or is reparameterization just not available for such distribution? Thank you

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 at the MixtureSameFamily entry point and reproduce the reported Python example with reparameterize=True. Investigate why the MultivariateNormalDiag components trigger the univariate_components error. Done means the behavior is clarified with a supported workaround, or reparameterized sampling works for this distribution.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.