tfp.experimental.distributions.log_prob_ratio
Stay organized with collections
Save and categorize content based on your preferences.
Computes p.log_prob(x) - q.log_prob(y)
, numerically stably.
tfp.experimental.distributions.log_prob_ratio(
p, x, q, y, name=None, **kwargs
)
Args |
p
|
A distribution instance.
|
x
|
A tensor from the support of p .
|
q
|
A distribution instance in the same family as p , with matching shape.
|
y
|
A tensor from the support of q .
|
name
|
Optional name for ops in this scope.
|
**kwargs
|
Passed to the distribution's log_prob_ratio implementation.
|
Returns |
lp_ratio
|
log (p(x) / q(y)) = p.log_prob(x) - q.log_prob(y) . In some cases
this will be computed with better than naive numerical precision, e.g. by
moving the difference inside of a sum reduction.
|
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.experimental.distributions.log_prob_ratio\n\n\u003cbr /\u003e\n\n|-------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/probability/blob/v0.23.0/tensorflow_probability/python/distributions/log_prob_ratio.py#L38-L59) |\n\nComputes `p.log_prob(x) - q.log_prob(y)`, numerically stably. \n\n tfp.experimental.distributions.log_prob_ratio(\n p, x, q, y, name=None, **kwargs\n )\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|------------|-------------------------------------------------------------------------|\n| `p` | A distribution instance. |\n| `x` | A tensor from the support of `p`. |\n| `q` | A distribution instance in the same family as `p`, with matching shape. |\n| `y` | A tensor from the support of `q`. |\n| `name` | Optional name for ops in this scope. |\n| `**kwargs` | Passed to the distribution's `log_prob_ratio` implementation. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `lp_ratio` | `log (p(x) / q(y)) = p.log_prob(x) - q.log_prob(y)`. In some cases this will be computed with better than naive numerical precision, e.g. by moving the difference inside of a sum reduction. |\n\n\u003cbr /\u003e"]]