tensorflow / tensorflow/probability
Performance: Noncentral Chi2 Quantile is painfully slow for certain values
Nobody has claimed this yet.
- Dominant language
- Jupyter Notebook
- Stars
- 4.4k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
Congratulations and thanks for including the NCX2 quantile function! I've noticed that for certain values, the computation becomes painfully slow. An example to reproduce:
pts = tf.linspace(1e-3, 1 - 1e-3, 10)
ncx2 = tfd.NoncentralChi2(df=df, noncentrality=nc)
For df= 1; nc=1, the computation takes 0.10 to 0.35 seconds per value. For df =1, nc=4, the computation stalls for over 30 minutes when computing small values (say below 0.01). The code stalling is the find_root_secant procedure, up to and including the quant_approx step, the computation runs fine. Changing the tolerance doesn't seem to help.
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 the Noncentral Chi2 quantile path, especially the named find_root_secant procedure and the preceding quant_approx step. Reproduce the df=1, noncentrality=1 and 4 cases with the provided tf.linspace values, then verify that small quantiles no longer stall while retaining correct results.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, tensorflow
- Domain
- performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100