docstr: Initialise Bayesian GPLVM object. This method only works with a Gaussian likelihood.
  
  :param data: data matrix, size N (number of points) x P (dimensions)
  :param X_data_mean: initial latent positions, size N (number of points) x
      Q (latent dimensions).
  :param X_data_var: variance of latent positions ([N, Q]), for the initialisation of the
      latent space.
  :param kernel: kernel specification, by default Squared Exponential
  :param num_inducing_variables: number of inducing points, M
  :param inducing_variable: matrix of inducing points, size M (inducing points) x
      Q (latent dimensions). By default random permutation of X_data_mean.
  :param X_prior_mean: prior mean used in KL term of bound. By default 0.
      Same size as X_data_mean.
  :param X_prior_var: prior variance used in KL term of bound. By default 1.
docstr_tok: ["Initialise","Bayesian","GPLVM","object",".","This","method","only","works","with","a","Gaussian","likelihood",".",":","param","data",":","data","matrix",",","size","N","(","number","of","points",")","x","P","(","dimensions",")",":","param","X_data_mean",":","initial","latent","positions",",","size","N","(","number","of","points",")","x","Q","(","latent","dimensions",")",".",":","param","X_data_var",":","variance","of","latent","positions","(","[","N",",","Q","]",")",",","for","the","initialisation","of","the","latent","space",".",":","param","kernel",":","kernel","specification",",","by","default","Squared","Exponential",":","param","num_inducing_variables",":","number","of","inducing","points",",","M",":","param","inducing_variable",":","matrix","of","inducing","points",",","size","M","(","inducing","points",")","x","Q","(","latent","dimensions",")",".","By","default","random","permutation","of","X_data_mean",".",":","param","X_prior_mean",":","prior","mean","used","in","KL","term","of","bound",".","By","default","0",".","Same","size","as","X_data_mean",".",":","param","X_prior_var",":","prior","variance","used","in","KL","term","of","bound",".","By","default","1","."]
code: def __init__(
      self,
      data: OutputData,
      X_data_mean: tf.Tensor,
      X_data_var: tf.Tensor,
      kernel: Kernel,
      num_inducing_variables: Optional[int] = None,
      inducing_variable: Optional[InducingVariablesLike] = None,
      X_prior_mean: Optional[TensorType] = None,
      X_prior_var: Optional[TensorType] = None,
  ):
      """
      Initialise Bayesian GPLVM object. This method only works with a Gaussian likelihood.
  
      :param data: data matrix, size N (number of points) x P (dimensions)
      :param X_data_mean: initial latent positions, size N (number of points) x
          Q (latent dimensions).
      :param X_data_var: variance of latent positions ([N, Q]), for the initialisation of the
          latent space.
      :param kernel: kernel specification, by default Squared Exponential
      :param num_inducing_variables: number of inducing points, M
      :param inducing_variable: matrix of inducing points, size M (inducing points) x
          Q (latent dimensions). By default random permutation of X_data_mean.
      :param X_prior_mean: prior mean used in KL term of bound. By default 0.
          Same size as X_data_mean.
      :param X_prior_var: prior variance used in KL term of bound. By default 1.
      """
      num_data, num_latent_gps = X_data_mean.shape
      super().__init__(
          kernel, likelihoods.Gaussian(), num_latent_gps=num_latent_gps
      )
      self.data = data_input_to_tensor(data)
  
      self.X_data_mean = Parameter(X_data_mean)
      self.X_data_var = Parameter(X_data_var, transform=positive())
  
      self.num_data = num_data
      self.output_dim = self.data.shape[-1]
  
      if (inducing_variable is None) == (
          num_inducing_variables is None
      ):
          raise ValueError(
              "BayesianGPLVM needs exactly one of `inducing_variable` and"
              " `num_inducing_variables`"
          )
  
      if inducing_variable is None:
          # By default we initialize by subset of initial latent points
          # Note that tf.random.shuffle returns a copy, it does not shuffle in-place
          Z = tf.random.shuffle(X_data_mean)[:num_inducing_variables]
          inducing_variable = InducingPoints(Z)
  
      self.inducing_variable = inducingpoint_wrapper(inducing_variable)
  
      assert X_data_mean.shape[1] == self.num_latent_gps
  
      # deal with parameters for the prior mean variance of X
      if X_prior_mean is None:
          X_prior_mean = tf.zeros(
              (self.num_data, self.num_latent_gps),
              dtype=default_float(),
          )
      if X_prior_var is None:
          X_prior_var = tf.ones((self.num_data, self.num_latent_gps))
  
      self.X_prior_mean = tf.convert_to_tensor(
          np.atleast_1d(X_prior_mean), dtype=default_float()
      )
      self.X_prior_var = tf.convert_to_tensor(
          np.atleast_1d(X_prior_var), dtype=default_float()
      )
  
imports: from typing import Optional
  import numpy
  import tensorflow
  from check_shapes import check_shapes, inherit_check_shapes
  from ..None import covariances, kernels, likelihoods
  from ..base import InputData, MeanAndVariance, OutputData, Parameter, RegressionData, TensorType
  from ..config import default_float, default_jitter
  from ..expectations import expectation
  from ..inducing_variables import InducingPoints
  from ..kernels import Kernel
  from ..mean_functions import MeanFunction, Zero
  from ..probability_distributions import DiagonalGaussian
  from ..utilities import assert_params_false, positive, to_default_float
  from ..utilities.ops import pca_reduce
  from .gpr import GPR
  from .model import GPModel
  from .training_mixins import InternalDataTrainingLossMixin
  from .util import InducingVariablesLike, data_input_to_tensor, inducingpoint_wrapper
label_desc: Use image node_id 1 to create a new BayesianGPLVM object from inherited base classes: GPModel, InternalDataTrainingLossMixin with example: obj = BayesianGPLVM(data, X_data_mean, X_data_var, kernel, num_inducing_variables, inducing_variable, X_prior_mean, X_prior_var)