tensorflow / tensorflow/probability
Enhance documentation for ScaleMatvecTriL bijector reg. "batch behavior"?
Nobody has claimed this yet.
- Dominant language
- Jupyter Notebook
- Stars
- 4.4k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
porting the new bijectors to R, I was a bit confused by ScaleMatvecTriLs behavior (as opposed to what I was expecting from the documentation,
My test case was like this
tril = np.array([[1., 0],[1, 1]])
x = np.array([[1., 2], [3, 4]])
tril @ x
#array([[1., 2.],
# [4., 6.]])
bijector = tfp.bijectors.ScaleMatvecTriL(tril)
bijector.forward(x)
#<tf.Tensor: shape=(2, 2), dtype=float64, numpy=
#array([[1., 3.],
# [3., 7.]])>
From looking at
https://www.tensorflow.org/api_docs/python/tf/linalg/LinearOperatorLowerTriangular
, I think what is going on is that the operator acts on every row separately (treating the first dimension as a batch dimension).
Do you think it makes sense to go into a bit more detail on this in the documentation, to make it easier on users to understand the behavior?
Thanks!
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 with tensorflow_probability/python/bijectors/scale_matvec_tril.py at the documentation referenced near line 42, then compare its explanation with tf.linalg.LinearOperatorLowerTriangular and the reported ScaleMatvecTriL example. Clarify how matrix dimensions are interpreted and how batch behavior produces the shown result; done means the documentation explains this behavior unambiguously.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, tensorflow
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100