tensorflow / tensorflow/probability
Add support for weights in Empirical distributions
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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