tensorflow / tensorflow/probability
hypergeometric 2F1 undefined for legitimate inputs
Nobody has claimed this yet.
- Dominant language
- Jupyter Notebook
- Stars
- 4.4k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
In my research on Gaussian Processes I needed hypergeometric function2F1 for small arguments (less than 1 in absolute value).
I have found that the current implementation of hyp2f1_small_argument is incomplete:
To reproduce, run this in Colab and compare against Scipy or Mathematica
import tensorflow_probability as tfp
hyp2f1 = tfp.math.hypergeometric.hyp2f1_small_argument
H = 1
a = tf.constant(1.0)
b = tf.constant(0.5 - H)
c = tf.constant(H + 1.5)
x = tf.constant(0.9901961)
hyp2f1(a,b,c,x) # nan, should be ~ 0.753603
Tested under tfp==0.25.0 and tf==2.18.0 on Google Colab.
Here is the problematic code:
https://github.com/tensorflow/probability/blob/65f265c62bb1e2d15ef3e25104afb245a6d52429/tensorflow_probability/python/math/hypergeometric.py#L524-L681
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 in tensorflow_probability/python/math/hypergeometric.py, especially hyp2f1_small_argument and the referenced lines 524-681. Reproduce the provided inputs in Colab and compare the result with SciPy or Mathematica. Done means the legitimate small-argument case returns a finite value near 0.753603 rather than NaN, with regression coverage for the example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, tensorflow
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100