docstr: This method computes the negative marginal log likelihood
  
  .. math::
      :nowrap:
  
          \begin{aligned}
              \frac{1}{2} [d \log(2\pi) + \log(|K|) + y^TK^{-1}y],
          \end{aligned}
  
  where :math:`d` is the number of data points.
  This can be written in terms of the Cholesky factor  :math:`L` as
  
  .. math::
      :nowrap:
  
      \begin{aligned}
          \log(|K|) = \log(|LL^T|) &= \log(|L||L|^T) = \log(|L|^2) = 2\log(|L|) \\
          &= 2\log\big(\prod_i^n L_{ii}\big) = 2 \sum_i^N \log(L_{ii})
      \end{aligned}
           and
  
  .. math::
      :nowrap:
  
           \begin{aligned}
              y^TK^{-1}y = (y^TL^{-T})(L^{-1}y) = (L^{-1}y)^T(L^{-1}y) = ||L^{-1}y||_2^2.
          \end{aligned}
  
  Parameters
  --------------------
  x_train
      Training set of features of shape (batch_size, context_length, num_features).
  y_train
      Training labels of shape (batch_size, context_length).
  
  Returns
  --------------------
  Tensor
      The negative log marginal likelihood of shape (batch_size,)
docstr_tok: ["This","method","computes","the","negative","marginal","log","likelihood","..","math",":",":",":","nowrap",":","\\begin","{","aligned","}","\\frac","{","1","}","{","2","}","[","d","\\log","(","2\\pi",")","+","\\log","(","|K|",")","+","y^TK^","{","-1","}","y","]",",","\\end","{","aligned","}","where",":","math",":","`","d","`","is","the","number","of","data","points",".","This","can","be","written","in","terms","of","the","Cholesky","factor",":","math",":","`","L","`","as","..","math",":",":",":","nowrap",":","\\begin","{","aligned","}","\\log","(","|K|",")","=","\\log","(","|LL^T|",")","&","=","\\log","(","|L||L|^T",")","=","\\log","(","|L|^2",")","=","2\\log","(","|L|",")","\\\\","&","=","2\\log\\big","(","\\prod_i^n","L_","{","ii","}","\\big",")","=","2","\\sum_i^N","\\log","(","L_","{","ii","}",")","\\end","{","aligned","}","and","..","math",":",":",":","nowrap",":","\\begin","{","aligned","}","y^TK^","{","-1","}","y","=","(","y^TL^","{","-T","}",")","(","L^","{","-1","}","y",")","=","(","L^","{","-1","}","y",")","^T","(","L^","{","-1","}","y",")","=","||L^","{","-1","}","y||_2^2",".","\\end","{","aligned","}","Parameters","--","--","--","--","--","--","--","--","--","--","x_train","Training","set","of","features","of","shape","(","batch_size",",","context_length",",","num_features",")",".","y_train","Training","labels","of","shape","(","batch_size",",","context_length",")",".","Returns","--","--","--","--","--","--","--","--","--","--","Tensor","The","negative","log","marginal","likelihood","of","shape","(","batch_size",",",")"]
code: def log_prob(self, x_train: Tensor, y_train: Tensor) -> Tensor:
      r"""
          This method computes the negative marginal log likelihood
  
          .. math::
              :nowrap:
  
                  \begin{aligned}
                      \frac{1}{2} [d \log(2\pi) + \log(|K|) + y^TK^{-1}y],
                  \end{aligned}
  
          where :math:`d` is the number of data points.
          This can be written in terms of the Cholesky factor  :math:`L` as
  
          .. math::
              :nowrap:
  
              \begin{aligned}
                  \log(|K|) = \log(|LL^T|) &= \log(|L||L|^T) = \log(|L|^2) = 2\log(|L|) \\
                  &= 2\log\big(\prod_i^n L_{ii}\big) = 2 \sum_i^N \log(L_{ii})
              \end{aligned}
                   and
  
          .. math::
              :nowrap:
  
                   \begin{aligned}
                      y^TK^{-1}y = (y^TL^{-T})(L^{-1}y) = (L^{-1}y)^T(L^{-1}y) = ||L^{-1}y||_2^2.
                  \end{aligned}
  
          Parameters
          --------------------
          x_train
              Training set of features of shape (batch_size, context_length, num_features).
          y_train
              Training labels of shape (batch_size, context_length).
  
          Returns
          --------------------
          Tensor
              The negative log marginal likelihood of shape (batch_size,)
          """  # noqa: E501
      assert (
          self.context_length is not None
      ), "The value of `context_length` must be set."
      return -MultivariateGaussian(
          self.F.zeros_like(y_train),  # 0 mean gaussian process prior
          self._compute_cholesky_gp(
              self.kernel.kernel_matrix(x_train, x_train),
              self.context_length,
          ),
      ).log_prob(y_train)
  
file_path: gluonts/src/gluonts/mx/model/gp_forecaster/gaussian_process.py
imports: from typing import Optional, Tuple, Type
  import mxnet
  import numpy
  from gluonts.mx import Tensor
  from gluonts.mx.distribution import MultivariateGaussian
  from gluonts.mx.distribution.distribution import getF
  from gluonts.mx.kernels import Kernel
  from gluonts.mx.linalg_util import batch_diagonal, jitter_cholesky, jitter_cholesky_eig
label_desc: Use image node_id 3 for calling the GaussianProcess obj's underlying member method code with example usage: obj.log_prob(x_train, y_train) and returns: unknown