tfp.experimental.mcmc.remc_thermodynamic_integrals
Stay organized with collections
Save and categorize content based on your preferences.
Estimate thermodynamic integrals using results of ReplicaExchangeMC.
tfp.experimental.mcmc.remc_thermodynamic_integrals(
inverse_temperatures, potential_energy, iid_chain_ndims=0
)
Write the density, when tempering with inverse temperature b
, as
p_b(x) = exp(-b * U(x)) f(x) / Z_b
. Here Z_b
is a normalizing constant,
and U(x)
is the potential energy. f(x) is the untempered part, if any.
Let E_b[U(X)]
be the expected potential energy when X ~ p_b
. Then,
-1 * integral_c^d E_b[U(X)] db = log[Z_d / Z_c]
, the log normalizing
constant ratio.
Let Var_b[U(X)] be the variance of potential energy when
X ~ p_b(x). Then,
integral_c^d Var_b[U(X)] db = E_d[U(X)] - E_c[U(X)]`, the cross entropy
difference.
Integration is done via the trapezoidal rule. Assume E_b[U(X)]
and
Var_b[U(X)]
have bounded second derivatives, uniform in b
. Then, the
bias due to approximation of the integral by a summation is O(1 / K^2)
.
Suppose U(X)
, X ~ p_b
has bounded fourth moment, uniform in b
. Suppose
further that the swap acceptance rate between every adjacent pair is greater
than C_s > 0
. If we have N
effective samples from each of the n_replica
replicas, then the standard error of the summation is
O(1 / Sqrt(n_replica * N))
.
Args |
inverse_temperatures
|
Tensor of shape [n_replica, ...] , used to temper
n_replica replicas. Assumed to be decreasing with respect to the replica
index.
|
potential_energy
|
The potential_energy field of
ReplicaExchangeMCKernelResults , shape [n_samples, n_replica, ...] .
If the kth replica has density p_k(x) = exp(-beta_k * U(x)) * f_k(x) ,
then potential_energy[k] is U(X) , where X ~ p_k .
|
iid_chain_ndims
|
Number of dimensions in potential_energy , to the
right of the replica dimension, that index independent identically
distributed chains. In particular, the temperature for these chains should
be identical. The sample means will be computed over these dimensions.
|
Returns |
ReplicaExchangeMCThermodynamicIntegrals namedtuple.
|
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.
[[["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.experimental.mcmc.remc_thermodynamic_integrals\n\n\u003cbr /\u003e\n\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/probability/blob/v0.23.0/tensorflow_probability/python/experimental/mcmc/thermodynamic_integrals.py#L29-L104) |\n\nEstimate thermodynamic integrals using results of ReplicaExchangeMC. \n\n tfp.experimental.mcmc.remc_thermodynamic_integrals(\n inverse_temperatures, potential_energy, iid_chain_ndims=0\n )\n\nWrite the density, when tempering with inverse temperature `b`, as\n`p_b(x) = exp(-b * U(x)) f(x) / Z_b`. Here `Z_b` is a normalizing constant,\nand `U(x)` is the potential energy. f(x) is the untempered part, if any.\n\nLet `E_b[U(X)]` be the expected potential energy when `X ~ p_b`. Then,\n`-1 * integral_c^d E_b[U(X)] db = log[Z_d / Z_c]`, the log normalizing\nconstant ratio.\n\nLet `Var_b[U(X)] be the variance of potential energy when`X \\~ p_b(x)`. Then,`integral_c\\^d Var_b\\[U(X)\\] db = E_d\\[U(X)\\] - E_c\\[U(X)\\]\\`, the cross entropy\ndifference.\n\nIntegration is done via the trapezoidal rule. Assume `E_b[U(X)]` and\n`Var_b[U(X)]` have bounded second derivatives, uniform in `b`. Then, the\nbias due to approximation of the integral by a summation is `O(1 / K^2)`.\n\nSuppose `U(X)`, `X ~ p_b` has bounded fourth moment, uniform in `b`. Suppose\nfurther that the swap acceptance rate between every adjacent pair is greater\nthan `C_s \u003e 0`. If we have `N` effective samples from each of the `n_replica`\nreplicas, then the standard error of the summation is\n`O(1 / Sqrt(n_replica * N))`.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `inverse_temperatures` | `Tensor` of shape `[n_replica, ...]`, used to temper `n_replica` replicas. Assumed to be decreasing with respect to the replica index. |\n| `potential_energy` | The `potential_energy` field of `ReplicaExchangeMCKernelResults`, shape `[n_samples, n_replica, ...]`. If the kth replica has density `p_k(x) = exp(-beta_k * U(x)) * f_k(x)`, then `potential_energy[k]` is `U(X)`, where `X ~ p_k`. |\n| `iid_chain_ndims` | Number of dimensions in `potential_energy`, to the right of the replica dimension, that index independent identically distributed chains. In particular, the temperature for these chains should be identical. The sample means will be computed over these dimensions. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| ReplicaExchangeMCThermodynamicIntegrals namedtuple. ||\n\n\u003cbr /\u003e"]]