tfp.math.log_gamma_correction
Stay organized with collections
Save and categorize content based on your preferences.
Returns the error of the Stirling approximation to lgamma(x) for x >= 8.
tfp.math.log_gamma_correction(
x, name=None
)
This is useful for accurately evaluating ratios between Gamma functions, as
happens when trying to compute Beta functions.
Specifically,
lgamma(x) approx (x - 0.5) * log(x) - x + 0.5 log (2 pi)
+ log_gamma_correction(x)
for x >= 8.
This is the function called Delta in [1], eq (30). We implement it with
the rational minimax approximation given in [1], eq (32).
References:
[1] DiDonato and Morris, "Significant Digit Computation of the Incomplete Beta
Function Ratios", 1988. Technical report NSWC TR 88-365, Naval Surface
Warfare Center (K33), Dahlgren, VA 22448-5000. Section IV, Auxiliary
Functions. https://apps.dtic.mil/dtic/tr/fulltext/u2/a210118.pdf
Args |
x
|
Floating-point Tensor at which to evaluate the log gamma correction
elementwise. The approximation is accurate when x >= 8.
|
name
|
Optional Python str naming the operation.
|
Returns |
lgamma_corr
|
Tensor of elementwise log gamma corrections.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-11-21 UTC.
[null,null,["Last updated 2023-11-21 UTC."],[],[],null,["# tfp.math.log_gamma_correction\n\n\u003cbr /\u003e\n\n|-------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/probability/blob/v0.23.0/tensorflow_probability/python/math/special.py#L1854-L1903) |\n\nReturns the error of the Stirling approximation to lgamma(x) for x \\\u003e= 8. \n\n tfp.math.log_gamma_correction(\n x, name=None\n )\n\nThis is useful for accurately evaluating ratios between Gamma functions, as\nhappens when trying to compute Beta functions.\n\nSpecifically, \n\n lgamma(x) approx (x - 0.5) * log(x) - x + 0.5 log (2 pi)\n + log_gamma_correction(x)\n\nfor x \\\u003e= 8.\n\nThis is the function called Delta in \\[1\\], eq (30). We implement it with\nthe rational minimax approximation given in \\[1\\], eq (32).\n\n#### References:\n\n\\[1\\] DiDonato and Morris, \"Significant Digit Computation of the Incomplete Beta\nFunction Ratios\", 1988. Technical report NSWC TR 88-365, Naval Surface\nWarfare Center (K33), Dahlgren, VA 22448-5000. Section IV, Auxiliary\nFunctions. \u003chttps://apps.dtic.mil/dtic/tr/fulltext/u2/a210118.pdf\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|--------|------------------------------------------------------------------------------------------------------------------------------|\n| `x` | Floating-point Tensor at which to evaluate the log gamma correction elementwise. The approximation is accurate when x \\\u003e= 8. |\n| `name` | Optional Python `str` naming the operation. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---------------|----------------------------------------------|\n| `lgamma_corr` | Tensor of elementwise log gamma corrections. |\n\n\u003cbr /\u003e"]]