class_docstr: Auxiliary variable reparameterizer for
  :class:`~pyro.distributions.Stable` latent variables.
  
  This is useful in inference of latent :class:`~pyro.distributions.Stable`
  variables because the :meth:`~pyro.distributions.Stable.log_prob` is not
  implemented.
  
  This uses the Chambers-Mallows-Stuck method [1], creating a pair of
  parameter-free auxiliary distributions (``Uniform(-pi/2,pi/2)`` and
  ``Exponential(1)``) with well-defined ``.log_prob()`` methods, thereby
  permitting use of reparameterized stable distributions in likelihood-based
  inference algorithms like SVI and MCMC.
  
  This reparameterization works only for latent variables, not likelihoods.
  For likelihood-compatible reparameterization see
  :class:`SymmetricStableReparam` or :class:`StableReparam` .
  
  [1] J.P. Nolan (2017).
      Stable Distributions: Models for Heavy Tailed Data.
      https://edspace.american.edu/jpnolan/wp-content/uploads/sites/1720/2020/09/Chap1.pdf
class_docstr_tok: ["Auxiliary","variable","reparameterizer","for",":","class",":","`","~pyro.distributions.Stable","`","latent","variables",".","This","is","useful","in","inference","of","latent",":","class",":","`","~pyro.distributions.Stable","`","variables","because","the",":","meth",":","`","~pyro.distributions.Stable.log_prob","`","is","not","implemented",".","This","uses","the","Chambers-Mallows-Stuck","method","[","1","]",",","creating","a","pair","of","parameter-free","auxiliary","distributions","(","``","Uniform","(","-pi\/2",",","pi\/2",")","``","and","``","Exponential","(","1",")","``",")","with","well-defined","``",".log_prob","(",")","``","methods",",","thereby","permitting","use","of","reparameterized","stable","distributions","in","likelihood-based","inference","algorithms","like","SVI","and","MCMC",".","This","reparameterization","works","only","for","latent","variables",",","not","likelihoods",".","For","likelihood-compatible","reparameterization","see",":","class",":","`","SymmetricStableReparam","`","or",":","class",":","`","StableReparam","`",".","[","1","]","J.P.","Nolan","(","2017",")",".","Stable","Distributions",":","Models","for","Heavy","Tailed","Data",".","https",":","\/\/edspace.american.edu\/jpnolan\/wp-content\/uploads\/sites\/1720\/2020\/09\/Chap1.pdf"]
code: def apply(self, msg):
      name = msg["name"]
      fn = msg["fn"]
      # ignore msg["value"]
      is_observed = msg["is_observed"]
  
      fn, event_dim = self._unwrap(fn)
      assert isinstance(fn, dist.Stable) and fn.coords == "S0"
      if is_observed:
          raise NotImplementedError(
              f"At pyro.sample({repr(name)},...), "
              "LatentStableReparam does not support observe statements"
          )
  
      # Draw parameter-free noise.
      proto = fn.stability
      half_pi = proto.new_tensor(math.pi / 2)
      one = proto.new_ones(proto.shape)
      u = pyro.sample(
          "{}_uniform".format(name),
          self._wrap(
              dist.Uniform(-half_pi, half_pi).expand(proto.shape),
              event_dim,
          ),
      )
      e = pyro.sample(
          "{}_exponential".format(name),
          self._wrap(dist.Exponential(one), event_dim),
      )
  
      # Differentiably transform.
      x = _standard_stable(fn.stability, fn.skew, u, e, coords="S0")
      value = fn.loc + fn.scale * x
  
      # Simulate a pyro.deterministic() site.
      new_fn = dist.Delta(value, event_dim=event_dim).mask(False)
      return {"fn": new_fn, "value": value, "is_observed": True}
  
file_path: pyro/pyro/infer/reparam/stable.py
imports: import math
  import torch
  import pyro
  import pyro.distributions
  from pyro.distributions.stable import _standard_stable, _unsafe_standard_stable
  from pyro.infer.util import is_validation_enabled
  from .reparam import Reparam
label_desc: Use image node_id 1 for calling the LatentStableReparam obj's underlying member method code with example usage: obj.apply(msg) and returns: dict