tensorflow / tensorflow/probability

Add support for weights in Empirical distributions

Open
#869 0 comments 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

Hello,

If I'm not mistaken Empirical distributions don't allow for non-uniform weighting at the moment. This could be of tremendous value for any application using importance sampling. Is there any plan for supporting it in the future?

Ideally the signature should be left almost unchanged:

tfp.distributions.Empirical(
    samples, weights=None, event_ndims=0, validate_args=False, allow_nan_stats=True,
    name='Empirical'
)

Then the implementation of the different distribution methods would be similar to the ones you already have, for example instead of drawing indices uniformly in _sample_n you could simply draw them from a multinomial distribution or using standard resampling techniques such as systematic or stratified resampling to reduce the variance.

It seems to me like it would also help to solve this issue

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 tfp.distributions.Empirical and review its existing distribution methods, especially _sample_n, along with the related issue #704. The work is done when Empirical accepts an optional weights argument and its distribution behavior uses those weights consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, 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.