class_docstr: Hamiltonian Monte Carlo, also known as hybrid Monte Carlo
  [@duane1987hybrid; @neal2011mcmc].
  
  #### Notes
  
  In conditional inference, we infer $z$ in $p(z, \beta
  \mid x)$ while fixing inference over $\beta$ using another
  distribution $q(\beta)$.
  `HMC` substitutes the model's log marginal density
  
  $\log p(x, z) = \log \mathbb{E}_{q(\beta)} [ p(x, z, \beta) ]
                \approx \log p(x, z, \beta^*)$
  
  leveraging a single Monte Carlo sample, where $\beta^* \sim
  q(\beta)$. This is unbiased (and therefore asymptotically exact as a
  pseudo-marginal method) if $q(\beta) = p(\beta \mid x)$.
  
  #### Examples
  
  ```python
  mu = Normal(loc=0.0, scale=1.0)
  x = Normal(loc=mu, scale=1.0, sample_shape=10)
  
  qmu = Empirical(tf.Variable(tf.zeros(500)))
  inference = ed.HMC({mu: qmu}, {x: np.zeros(10, dtype=np.float32)})
  ```
class_docstr_tok: ["Hamiltonian","Monte","Carlo",",","also","known","as","hybrid","Monte","Carlo","[","@","duane1987hybrid",";","@","neal2011mcmc","]",".","#","#","#","#","Notes","In","conditional","inference",",","we","infer","$","z","$","in","$","p","(","z",",","\\beta","\\mid","x",")","$","while","fixing","inference","over","$","\\beta","$","using","another","distribution","$","q","(","\\beta",")","$",".","`","HMC","`","substitutes","the","model","'s","log","marginal","density","$","\\log","p","(","x",",","z",")","=","\\log","\\mathbb","{","E","}","_","{","q","(","\\beta",")","}","[","p","(","x",",","z",",","\\beta",")","]","\\approx","\\log","p","(","x",",","z",",","\\beta^","*",")","$","leveraging","a","single","Monte","Carlo","sample",",","where","$","\\beta^","*","\\sim","q","(","\\beta",")","$",".","This","is","unbiased","(","and","therefore","asymptotically","exact","as","a","pseudo-marginal","method",")","if","$","q","(","\\beta",")","=","p","(","\\beta","\\mid","x",")","$",".","#","#","#","#","Examples","``","`","python","mu","=","Normal","(","loc=0.0",",","scale=1.0",")","x","=","Normal","(","loc=mu",",","scale=1.0",",","sample_shape=10",")","qmu","=","Empirical","(","tf.Variable","(","tf.zeros","(","500",")",")",")","inference","=","ed.HMC","(","{","mu",":","qmu","}",",","{","x",":","np.zeros","(","10",",","dtype=np.float32",")","}",")","``","`"]
docstr: Given a sample in unconstrained latent space, transform it back into
  the original space, and compute the log joint density with appropriate
  Jacobian correction.
docstr_tok: ["Given","a","sample","in","unconstrained","latent","space",",","transform","it","back","into","the","original","space",",","and","compute","the","log","joint","density","with","appropriate","Jacobian","correction","."]
code: def _log_joint_unconstrained(self, z_sample):
      """
      Given a sample in unconstrained latent space, transform it back into
      the original space, and compute the log joint density with appropriate
      Jacobian correction.
      """
  
      unconstrained_to_z = {
          v: k for (k, v) in self.transformations.items()
      }
  
      # transform all samples back into the original (potentially
      # constrained) space.
      z_sample_transformed = {}
      log_det_jacobian = 0.0
      for z_unconstrained, qz_unconstrained in z_sample.items():
          z = (
              unconstrained_to_z[z_unconstrained]
              if z_unconstrained in unconstrained_to_z
              else z_unconstrained
          )
  
          try:
              bij = self.transformations[z].bijector
              z_sample_transformed[z] = bij.inverse(qz_unconstrained)
              log_det_jacobian += tf.reduce_sum(
                  bij.inverse_log_det_jacobian(qz_unconstrained)
              )
          except:  # if z not in self.transformations,
              # or is not a TransformedDist w/ bijector
              z_sample_transformed[z] = qz_unconstrained
  
      return self._log_joint(z_sample_transformed) + log_det_jacobian
  
file_path: edward/edward/inferences/hmc.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import six
  import tensorflow
  from collections import OrderedDict
  from edward.inferences.monte_carlo import MonteCarlo
  from edward.models import RandomVariable
  from edward.util import copy
label_desc: Use image node_id 4 for calling the HMC obj's underlying member method code with example usage: obj._log_joint_unconstrained(z_sample) and returns: unknown