class_docstr: Sparse Gaussian Process Regression model.
  
  In :class:`.GPRegression` model, when the number of input data :math:`X` is large,
  the covariance matrix :math:`k(X, X)` will require a lot of computational steps to
  compute its inverse (for log likelihood and for prediction). By introducing an
  additional inducing-input parameter :math:`X_u`, we can reduce computational cost
  by approximate :math:`k(X, X)` by a low-rank Nyström approximation :math:`Q`
  (see reference [1]), where
  
  .. math:: Q = k(X, X_u) k(X_u,X_u)^{-1} k(X_u, X).
  
  Given inputs :math:`X`, their noisy observations :math:`y`, and the inducing-input
  parameters :math:`X_u`, the model takes the form:
  
  .. math::
      u & \sim \mathcal{GP}(0, k(X_u, X_u)),\\
      f & \sim q(f \mid X, X_u) = \mathbb{E}_{p(u)}q(f\mid X, X_u, u),\\
      y & \sim f + \epsilon,
  
  where :math:`\epsilon` is Gaussian noise and the conditional distribution
  :math:`q(f\mid X, X_u, u)` is an approximation of
  
  .. math:: p(f\mid X, X_u, u) = \mathcal{N}(m, k(X, X) - Q),
  
  whose terms :math:`m` and :math:`k(X, X) - Q` is derived from the joint
  multivariate normal distribution:
  
  .. math:: [f, u] \sim \mathcal{GP}(0, k([X, X_u], [X, X_u])).
  
  This class implements three approximation methods:
  
  + Deterministic Training Conditional (DTC):
  
      .. math:: q(f\mid X, X_u, u) = \mathcal{N}(m, 0),
  
    which in turns will imply
  
      .. math:: f \sim \mathcal{N}(0, Q).
  
  + Fully Independent Training Conditional (FITC):
  
      .. math:: q(f\mid X, X_u, u) = \mathcal{N}(m, diag(k(X, X) - Q)),
  
    which in turns will correct the diagonal part of the approximation in DTC:
  
      .. math:: f \sim \mathcal{N}(0, Q + diag(k(X, X) - Q)).
  
  + Variational Free Energy (VFE), which is similar to DTC but has an additional
    `trace_term` in the model's log likelihood. This additional term makes "VFE"
    equivalent to the variational approach in :class:`.VariationalSparseGP`
    (see reference [2]).
  
  .. note:: This model has :math:`\mathcal{O}(NM^2)` complexity for training,
      :math:`\mathcal{O}(NM^2)` complexity for testing. Here, :math:`N` is the number
      of train inputs, :math:`M` is the number of inducing inputs.
  
  References:
  
  [1] `A Unifying View of Sparse Approximate Gaussian Process Regression`,
  Joaquin Quiñonero-Candela, Carl E. Rasmussen
  
  [2] `Variational learning of inducing variables in sparse Gaussian processes`,
  Michalis Titsias
  
  :param torch.Tensor X: A input data for training. Its first dimension is the number
      of data points.
  :param torch.Tensor y: An output data for training. Its last dimension is the
      number of data points.
  :param ~pyro.contrib.gp.kernels.kernel.Kernel kernel: A Pyro kernel object, which
      is the covariance function :math:`k`.
  :param torch.Tensor Xu: Initial values for inducing points, which are parameters
      of our model.
  :param torch.Tensor noise: Variance of Gaussian noise of this model.
  :param callable mean_function: An optional mean function :math:`m` of this Gaussian
      process. By default, we use zero mean.
  :param str approx: One of approximation methods: "DTC", "FITC", and "VFE"
      (default).
  :param float jitter: A small positive term which is added into the diagonal part of
      a covariance matrix to help stablize its Cholesky decomposition.
  :param str name: Name of this model.
class_docstr_tok: ["Sparse","Gaussian","Process","Regression","model",".","In",":","class",":","`",".GPRegression","`","model",",","when","the","number","of","input","data",":","math",":","`","X","`","is","large",",","the","covariance","matrix",":","math",":","`","k","(","X",",","X",")","`","will","require","a","lot","of","computational","steps","to","compute","its","inverse","(","for","log","likelihood","and","for","prediction",")",".","By","introducing","an","additional","inducing-input","parameter",":","math",":","`","X_u","`",",","we","can","reduce","computational","cost","by","approximate",":","math",":","`","k","(","X",",","X",")","`","by","a","low-rank","Nystr\u00f6m","approximation",":","math",":","`","Q","`","(","see","reference","[","1","]",")",",","where","..","math",":",":","Q","=","k","(","X",",","X_u",")","k","(","X_u",",","X_u",")","^","{","-1","}","k","(","X_u",",","X",")",".","Given","inputs",":","math",":","`","X","`",",","their","noisy","observations",":","math",":","`","y","`",",","and","the","inducing-input","parameters",":","math",":","`","X_u","`",",","the","model","takes","the","form",":","..","math",":",":","u","&","\\sim","\\mathcal","{","GP","}","(","0",",","k","(","X_u",",","X_u",")",")",",","\\\\","f","&","\\sim","q","(","f","\\mid","X",",","X_u",")","=","\\mathbb","{","E","}","_","{","p","(","u",")","}","q","(","f\\mid","X",",","X_u",",","u",")",",","\\\\","y","&","\\sim","f","+","\\epsilon",",","where",":","math",":","`","\\epsilon","`","is","Gaussian","noise","and","the","conditional","distribution",":","math",":","`","q","(","f\\mid","X",",","X_u",",","u",")","`","is","an","approximation","of","..","math",":",":","p","(","f\\mid","X",",","X_u",",","u",")","=","\\mathcal","{","N","}","(","m",",","k","(","X",",","X",")","-","Q",")",",","whose","terms",":","math",":","`","m","`","and",":","math",":","`","k","(","X",",","X",")","-","Q","`","is","derived","from","the","joint","multivariate","normal","distribution",":","..","math",":",":","[","f",",","u","]","\\sim","\\mathcal","{","GP","}","(","0",",","k","(","[","X",",","X_u","]",",","[","X",",","X_u","]",")",")",".","This","class","implements","three","approximation","methods",":","+","Deterministic","Training","Conditional","(","DTC",")",":","..","math",":",":","q","(","f\\mid","X",",","X_u",",","u",")","=","\\mathcal","{","N","}","(","m",",","0",")",",","which","in","turns","will","imply","..","math",":",":","f","\\sim","\\mathcal","{","N","}","(","0",",","Q",")",".","+","Fully","Independent","Training","Conditional","(","FITC",")",":","..","math",":",":","q","(","f\\mid","X",",","X_u",",","u",")","=","\\mathcal","{","N","}","(","m",",","diag","(","k","(","X",",","X",")","-","Q",")",")",",","which","in","turns","will","correct","the","diagonal","part","of","the","approximation","in","DTC",":","..","math",":",":","f","\\sim","\\mathcal","{","N","}","(","0",",","Q","+","diag","(","k","(","X",",","X",")","-","Q",")",")",".","+","Variational","Free","Energy","(","VFE",")",",","which","is","similar","to","DTC","but","has","an","additional","`","trace_term","`","in","the","model","'s","log","likelihood",".","This","additional","term","makes","``","VFE","''","equivalent","to","the","variational","approach","in",":","class",":","`",".VariationalSparseGP","`","(","see","reference","[","2","]",")",".","..","note",":",":","This","model","has",":","math",":","`","\\mathcal","{","O","}","(","NM^2",")","`","complexity","for","training",",",":","math",":","`","\\mathcal","{","O","}","(","NM^2",")","`","complexity","for","testing",".","Here",",",":","math",":","`","N","`","is","the","number","of","train","inputs",",",":","math",":","`","M","`","is","the","number","of","inducing","inputs",".","References",":","[","1","]","`","A","Unifying","View","of","Sparse","Approximate","Gaussian","Process","Regression","`",",","Joaquin","Qui\u00f1onero-Candela",",","Carl","E.","Rasmussen","[","2","]","`","Variational","learning","of","inducing","variables","in","sparse","Gaussian","processes","`",",","Michalis","Titsias",":","param","torch.Tensor","X",":","A","input","data","for","training",".","Its","first","dimension","is","the","number","of","data","points",".",":","param","torch.Tensor","y",":","An","output","data","for","training",".","Its","last","dimension","is","the","number","of","data","points",".",":","param","~pyro.contrib.gp.kernels.kernel.Kernel","kernel",":","A","Pyro","kernel","object",",","which","is","the","covariance","function",":","math",":","`","k","`",".",":","param","torch.Tensor","Xu",":","Initial","values","for","inducing","points",",","which","are","parameters","of","our","model",".",":","param","torch.Tensor","noise",":","Variance","of","Gaussian","noise","of","this","model",".",":","param","callable","mean_function",":","An","optional","mean","function",":","math",":","`","m","`","of","this","Gaussian","process",".","By","default",",","we","use","zero","mean",".",":","param","str","approx",":","One","of","approximation","methods",":","``","DTC","''",",","``","FITC","''",",","and","``","VFE","''","(","default",")",".",":","param","float","jitter",":","A","small","positive","term","which","is","added","into","the","diagonal","part","of","a","covariance","matrix","to","help","stablize","its","Cholesky","decomposition",".",":","param","str","name",":","Name","of","this","model","."]
code: def guide(self):
      self.set_mode("guide")
      self._load_pyro_samples()
  
file_path: pyro/pyro/contrib/gp/models/sgpr.py
imports: import torch
  from torch.distributions import constraints
  from torch.nn import Parameter
  import pyro
  import pyro.distributions
  from pyro.contrib.gp.models.model import GPModel
  from pyro.nn.module import PyroParam, pyro_method
label_desc: Use image node_id 3 for calling the SparseGPRegression obj's underlying member method code with example usage: obj.guide() without return types