[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-11-21 UTC."],[],[],null,["# tfp.substrates.numpy.vi.symmetrized_csiszar_function\n\n\u003cbr /\u003e\n\n|------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/probability/blob/v0.23.0/tensorflow_probability/substrates/numpy/vi/csiszar_divergence.py#L812-L880) |\n\nSymmetrizes a Csiszar-function in log-space.\n\n#### View aliases\n\n\n**Main aliases**\n\n[`tfp.experimental.substrates.numpy.vi.symmetrized_csiszar_function`](https://www.tensorflow.org/probability/api_docs/python/tfp/substrates/numpy/vi/symmetrized_csiszar_function)\n\n\u003cbr /\u003e\n\n tfp.substrates.numpy.vi.symmetrized_csiszar_function(\n logu, csiszar_function, name=None\n )\n\nA Csiszar-function is a member of, \n\n F = { f:R_+ to R : f convex }.\n\nThe symmetrized Csiszar-function is defined as: \n\n f_g(u) = 0.5 g(u) + 0.5 u g (1 / u)\n\nwhere `g` is some other Csiszar-function.\n\nWe say the function is \"symmetrized\" because: \n\n D_{f_g}[p, q] = D_{f_g}[q, p]\n\nfor all `p \u003c\u003c \u003e\u003e q` (i.e., `support(p) = support(q)`).\n\nThere exists alternatives for symmetrizing a Csiszar-function. For example, \n\n f_g(u) = max(f(u), f^*(u)),\n\nwhere `f^*` is the dual Csiszar-function, also implies a symmetric\nf-Divergence.\n\n#### Example:\n\nWhen either of the following functions are symmetrized, we obtain the\nJensen-Shannon Csiszar-function, i.e., \n\n g(u) = -log(u) - (1 + u) log((1 + u) / 2) + u - 1\n h(u) = log(4) + 2 u log(u / (1 + u))\n\nimplies, \n\n f_g(u) = f_h(u) = u log(u) - (1 + u) log((1 + u) / 2)\n = jensen_shannon(log(u)).\n\n| **Warning:** this function makes non-log-space calculations and may therefore be numerically unstable for `|logu| \u003e\u003e 0`.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|--------------------|--------------------------------------------------------------------|\n| `logu` | `float`-like `Tensor` representing `log(u)` from above. |\n| `csiszar_function` | Python `callable` representing a Csiszar-function over log-domain. |\n| `name` | Python `str` name prefixed to Ops created by this function. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|----------------------|---------------------------------------------------------------------------------------------------------|\n| `symmetrized_g_of_u` | `float`-like `Tensor` of the result of applying the symmetrization of `g` evaluated at `u = exp(logu)`. |\n\n\u003cbr /\u003e"]]