tensorflow / tensorflow/probability
tfd.MultivariateNormalTriL has not implemented quantile()?
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,
I tried to get a quantile of MultivariateNormalTriL distribution, but I got an error:
Traceback (most recent call last):
File "", line 1, in
File "/home/kai/miniconda3/envs/tf/lib/python3.10/site-packages/tensorflow_probability/python/distributions/distribution.py", line 1573, in quantile
return self._call_quantile(value, name, **kwargs)
File "/home/kai/miniconda3/envs/tf/lib/python3.10/site-packages/tensorflow_probability/python/distributions/distribution.py", line 1553, in _call_quantile
return self._quantile(value, **kwargs)
File "/home/kai/miniconda3/envs/tf/lib/python3.10/site-packages/tensorflow_probability/python/distributions/transformed_distribution.py", line 471, in _quantile
self.bijector._internal_is_increasing(**bijector_kwargs), # pylint: disable=protected-access
File "/home/kai/miniconda3/envs/tf/lib/python3.10/site-packages/tensorflow_probability/python/bijectors/bijector.py", line 1352, in _internal_is_increasing
return self._call_is_increasing(name, **kwargs)
File "/home/kai/miniconda3/envs/tf/lib/python3.10/site-packages/tensorflow_probability/python/bijectors/bijector.py", line 1336, in _call_is_increasing
return tf.identity(self._is_increasing(**kwargs))
File "/home/kai/miniconda3/envs/tf/lib/python3.10/site-packages/tensorflow_probability/python/bijectors/chain.py", line 137, in _is_increasing
is_increasing, b._internal_is_increasing(**kwargs.get(b.name, {}))) # pylint: disable=protected-access
File "/home/kai/miniconda3/envs/tf/lib/python3.10/site-packages/tensorflow_probability/python/bijectors/bijector.py", line 1352, in _internal_is_increasing
return self._call_is_increasing(name, **kwargs)
File "/home/kai/miniconda3/envs/tf/lib/python3.10/site-packages/tensorflow_probability/python/bijectors/bijector.py", line 1336, in _call_is_increasing
return tf.identity(self._is_increasing(**kwargs))
File "/home/kai/miniconda3/envs/tf/lib/python3.10/site-packages/tensorflow_probability/python/bijectors/bijector.py", line 1331, in _is_increasing
raise NotImplementedError(f'_is_increasingnot implemented in {cls}.')
NotImplementedError:_is_increasingnot implemented in <class 'tensorflow_probability.python.bijectors.scale_matvec_linear_operator.ScaleMatvecLinearOperator'>.
Code
>>> tfd = tfp.distributions
>>> # Initialize a single 3-variate Gaussian.
>>> mu = [1., 2, 3]
>>> cov = [[ 0.36, 0.12, 0.06],
... [ 0.12, 0.29, -0.13],
... [ 0.06, -0.13, 0.26]]
>>> scale = tf.linalg.cholesky(cov)
2023-04-28 19:14:26.857851: I tensorflow/core/util/cuda_solvers.cc:179] Creating GpuSolver handles for stream 0x56084b9cb4a0
>>> mvn = tfd.MultivariateNormalTriL(
... loc=mu,
... scale_tril=scale)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'tfd' is not defined. Did you mean: 'tfp'?
>>> tfd = tfp.distributions
>>> mvn = tfd.MultivariateNormalTriL(
... loc=mu,
... scale_tril=scale)
>>> mvn.quantile(0.95)
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 reproducing the example and tracing quantile handling through tensorflow_probability/python/distributions/distribution.py and transformed_distribution.py. Read the ScaleMatvecLinearOperator implementation referenced in the traceback and inspect existing distribution quantile tests. Done should include a defined multivariate quantile behavior for MultivariateNormalTriL, implementation coverage, and tests for the reported call.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100