tensorflow / tensorflow/probability

hypergeometric series unreliable for simple values

Open
#1,861 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Jupyter Notebook
Stars
4.4k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

The current implementation of hyp2f1 outputs wrong results for certain basic values, for example:

import tensorflow_probability as tfp

hyp2f1 = tfp.math.hypergeometric.hyp2f1_small_argument
H = 1
hyp2f1(1.0, 0.5 - H, H + 1.5, 9/10) # NaN

This happens under tensorflow_probability==0.24.0 and tensorflow==2.17.1 (e.g. under the current image used by Colab)

The correct result is

from scipy import special
hyp2f1 = special.hyp2f1
hyp2f1(1.0, 0.5 - H, H + 1.5, 9/10) # 0.7836799547024426

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported call to hyp2f1_small_argument with TensorFlow Probability 0.24.0 and TensorFlow 2.17.1, then trace that entry point to its implementation and existing tests. Compare the result with scipy.special.hyp2f1 for the supplied values; done means the basic case returns the expected finite value without breaking other cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, tensorflow
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.