tensorflow / tensorflow/probability

The documentation of each method of each distribution should be more specific

Open
#736 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

The documentation of the sample method of the distributions tfp.distributions.Bernoulli, tfp.distributions.Binomial, tfp.distributions.Categorical, tfp.distributions.Multinomial and probably many other distributions (if not all of them) is

Generate samples of the specified shape.

Note that a call to sample() without arguments will generate a single sample.

This is a very generic description. Ideally, the documentation should describe exactly what sample specifically does for each of the distributions.

For example, consider the Binomial distribution and the following program.

from tensorflow_probability import distributions as tfd

d = tfd.Binomial(total_count=4., probs=0.05)
print(d.sample())

which can apparently produce a tensor with either the value 0.0, 1.0, 2.0, 3.0 or 4.0, but it may not be cleary why, so I think that the documentation of each method should be adapted for each distribution, so that newbies can more easily understand the behaviour of each implemented distribution. In this case, sample seems to return the number of 1s in 4 trials (which can either be 0, 1, 2, 3 or 4), but this may not be correct or clear.

I haven't checked the documentation of the other methods, but they probably suffer from the same 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

The issue names the sample documentation for Bernoulli, Binomial, Categorical, and Multinomial distributions but does not identify files or tests. Start by locating those distribution docs and comparing their sample behavior; done means each method description explains the distribution-specific result and relevant parameters clearly.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, tensorflow
Domain
documentation, machine-learning
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.