tensorflow / tensorflow/probability
Why are two apparently equal distributions not equal?
Nobody has claimed this yet.
- Dominant language
- Jupyter Notebook
- Stars
- 4.4k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
Consider the following program
import tensorflow_probability as tfp
d = tfp.distributions.Normal(loc=[0], scale=[1])
d2 = tfp.distributions.Normal(loc=[0, 1], scale=[[0, 4],
[1, 3]])
assert d2[1, 0].loc == d.loc and d2[1, 0].scale == d.scale
print("d2[1, 0] == d?", d2[1, 0] == d)
which outputs
d2[1, 0] == d? False
Why this behavior? I haven't looked at the implementation, but I suppose you haven't overridden __eq__ and similar methods of the Normal class. If that's the case, you may want to do that, or is there any particular reason why you haven't done it?
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 by running the Python example with tensorflow_probability.distributions.Normal and inspect how Normal instances compare. Determine whether distributions with equivalent loc and scale should compare equal, and define the expected equality behavior before making a change; the issue is done when the behavior is documented and covered by an appropriate test.
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