class_docstr: A class that implements a categorical latent space wrapper for other Kernels.  It works
   by dynamically replacing integer labels in the input data with values in a latent space (Z),
   wrapping two kernels which are combined multiplicatively and otherwise work as normal.
  Kernel 1 is any kernel of your choice which will deal with the non-categorical dimensions.
  Kernel 2 deals with the categorical dimension.  It is fixed in training, in order to reduce the number
   of degrees of freedom in optimisation.  You may also find fixing the lengthscale to be useful here.
   Note that Z is parameterised by the differences of latent space values for each category for the same reason.
  Multiple categories can be included by wrapping multiple layers of CategoricalKernel.
  
  :param non_categorical_kernel: The non-categorical kernel.
  :param categorical_kernel: The categorical kernel.  Set its active_dims to the label dimension.
  :param num_labels: The number of labels
class_docstr_tok: ["A","class","that","implements","a","categorical","latent","space","wrapper","for","other","Kernels",".","It","works","by","dynamically","replacing","integer","labels","in","the","input","data","with","values","in","a","latent","space","(","Z",")",",","wrapping","two","kernels","which","are","combined","multiplicatively","and","otherwise","work","as","normal",".","Kernel","1","is","any","kernel","of","your","choice","which","will","deal","with","the","non-categorical","dimensions",".","Kernel","2","deals","with","the","categorical","dimension",".","It","is","fixed","in","training",",","in","order","to","reduce","the","number","of","degrees","of","freedom","in","optimisation",".","You","may","also","find","fixing","the","lengthscale","to","be","useful","here",".","Note","that","Z","is","parameterised","by","the","differences","of","latent","space","values","for","each","category","for","the","same","reason",".","Multiple","categories","can","be","included","by","wrapping","multiple","layers","of","CategoricalKernel",".",":","param","non_categorical_kernel",":","The","non-categorical","kernel",".",":","param","categorical_kernel",":","The","categorical","kernel",".","Set","its","active_dims","to","the","label","dimension",".",":","param","num_labels",":","The","number","of","labels"]
docstr: Z is a tensor whose entries are the latent space values of the relevant label
  i.e. Z[3] is the value of label 3.
docstr_tok: ["Z","is","a","tensor","whose","entries","are","the","latent","space","values","of","the","relevant","label","i.e",".","Z","[","3","]","is","the","value","of","label","3","."]
code: def Z(self) -> tf.Tensor:
      """
      Z is a tensor whose entries are the latent space values of the relevant label
      i.e. Z[3] is the value of label 3.
      """
      # This sets Z[0] = 0 and then creates Z[1:] by adding the deltas.
      #  This is achieved by using a lower diagonal matrix of ones,
      #  so Z[1] = _Z_deltas[0], Z[2] = _Z_deltas[0] + _Z_deltas[1], etc.
      Z = tf.concat(
          [
              tf.constant(0, shape=(1,), dtype=tf.float64),
              tf.squeeze(self._Z_deltas),
          ],
          0,
      )
      m = tf.linalg.band_part(
          tf.ones([tf.size(Z), tf.size(Z)], dtype=tf.float64), -1, 0
      )
      return tf.expand_dims(tf.linalg.matvec(m, Z), -1)
  
file_path: GPflow/gpflow/kernels/categorical.py
imports: from typing import Any, Optional
  import numpy
  import tensorflow
  from ..None import default_int, set_trainable
  from ..base import Parameter, TensorType
  from .None import Kernel
label_desc: Use image node_id 3 for calling the Categorical obj's underlying member method code with example usage: obj.Z() and returns: tf