def __init__(self,
               df,
               kernel,
               index_points,
               mean_fn=None,
               jitter=1e-6,
               validate_args=False,
               allow_nan_stats=False,
               name='StudentTProcess'):
    """Instantiate a StudentTProcess Distribution.

    Args:
      df: Positive Floating-point `Tensor` representing the degrees of freedom.
        Must be greater than 2.
      kernel: `PositiveSemidefiniteKernel`-like instance representing the
        TP's covariance function.
      index_points: `float` `Tensor` representing finite (batch of) vector(s) of
        points in the index set over which the TP is defined. Shape has the form
        `[b1, ..., bB, e, f1, ..., fF]` where `F` is the number of feature
        dimensions and must equal `kernel.feature_ndims` and `e` is the number
        (size) of index points in each batch. Ultimately this distribution
        corresponds to a `e`-dimensional multivariate Student's T. The batch
        shape must be broadcastable with `kernel.batch_shape` and any batch dims
        yielded by `mean_fn`.
      mean_fn: Python `callable` that acts on `index_points` to produce a (batch
        of) vector(s) of mean values at `index_points`. Takes a `Tensor` of
        shape `[b1, ..., bB, f1, ..., fF]` and returns a `Tensor` whose shape is
        broadcastable with `[b1, ..., bB]`. Default value: `None` implies
        constant zero function.
      jitter: `float` scalar `Tensor` added to the diagonal of the covariance
        matrix to ensure positive definiteness of the covariance matrix.
        Default value: `1e-6`.
      validate_args: Python `bool`, default `False`. When `True` distribution
        parameters are checked for validity despite possibly degrading runtime
        performance. When `False` invalid inputs may silently render incorrect
        outputs.
        Default value: `False`.
      allow_nan_stats: Python `bool`, default `True`. When `True`,
        statistics (e.g., mean, mode, variance) use the value "`NaN`" to
        indicate the result is undefined. When `False`, an exception is raised
        if one or more of the statistic's batch members are undefined.
        Default value: `False`.
      name: Python `str` name prefixed to Ops created by this class.
        Default value: "StudentTProcess".

    Raises:
      ValueError: if `mean_fn` is not `None` and is not callable.
    """
    parameters = dict(locals())
    with tf.name_scope(name) as name:
      dtype = dtype_util.common_dtype(
          [df, index_points, jitter], tf.float32)
      df = tf.convert_to_tensor(value=df, dtype=dtype, name='df')
      index_points = tf.convert_to_tensor(
          value=index_points, dtype=dtype, name='index_points')
      jitter = tf.convert_to_tensor(value=jitter, dtype=dtype, name='jitter')

      with tf.control_dependencies([
          assert_util.assert_greater(
              df, tf.cast(2., df.dtype), message='`df` must be greater than 2.')
      ] if validate_args else []):
        self._df = tf.identity(df)

      self._kernel = kernel
      self._index_points = index_points
      # Default to a constant zero function, borrowing the dtype from
      # index_points to ensure consistency.
      if mean_fn is None:
        mean_fn = lambda x: tf.zeros([1], dtype=dtype)
      else:
        if not callable(mean_fn):
          raise ValueError('`mean_fn` must be a Python callable')
      self._mean_fn = mean_fn
      self._jitter = jitter

      with tf.name_scope('init'):
        kernel_matrix = _add_diagonal_shift(
            kernel.matrix(self.index_points, self.index_points),
            jitter)
        self._covariance_matrix = kernel_matrix

        scale = tf.linalg.LinearOperatorLowerTriangular(
            tf.linalg.cholesky(
                ((self.df - 2) / self.df)[..., tf.newaxis, tf.newaxis] *
                kernel_matrix),
            is_non_singular=True,
            name='StudentTProcessScaleLinearOperator')

        super(StudentTProcess, self).__init__(
            df=df,
            loc=mean_fn(index_points),
            scale=scale,
            validate_args=validate_args,
            allow_nan_stats=allow_nan_stats,
            name=name)
        self._parameters = parameters
        self._graph_parents = [index_points, jitter]
def __init__ ( self , df , kernel , index_points , mean_fn = None , jitter = 1e-6 , validate_args = False , allow_nan_stats = False , name = 'StudentTProcess' ) : parameters = dict ( locals ( ) ) with tf . name_scope ( name ) as name : dtype = dtype_util . common_dtype ( [ df , index_points , jitter ] , tf . float32 ) df = tf . convert_to_tensor ( value = df , dtype = dtype , name = 'df' ) index_points = tf . convert_to_tensor ( value = index_points , dtype = dtype , name = 'index_points' ) jitter = tf . convert_to_tensor ( value = jitter , dtype = dtype , name = 'jitter' ) with tf . control_dependencies ( [ assert_util . assert_greater ( df , tf . cast ( 2. , df . dtype ) , message = '`df` must be greater than 2.' ) ] if validate_args else [ ] ) : self . _df = tf . identity ( df ) self . _kernel = kernel self . _index_points = index_points if mean_fn is None : mean_fn = lambda x : tf . zeros ( [ 1 ] , dtype = dtype ) else : if not callable ( mean_fn ) : raise ValueError ( '`mean_fn` must be a Python callable' ) self . _mean_fn = mean_fn self . _jitter = jitter with tf . name_scope ( 'init' ) : kernel_matrix = _add_diagonal_shift ( kernel . matrix ( self . index_points , self . index_points ) , jitter ) self . _covariance_matrix = kernel_matrix scale = tf . linalg . LinearOperatorLowerTriangular ( tf . linalg . cholesky ( ( ( self . df - 2 ) / self . df ) [ ... , tf . newaxis , tf . newaxis ] * kernel_matrix ) , is_non_singular = True , name = 'StudentTProcessScaleLinearOperator' ) super ( StudentTProcess , self ) . __init__ ( df = df , loc = mean_fn ( index_points ) , scale = scale , validate_args = validate_args , allow_nan_stats = allow_nan_stats , name = name ) self . _parameters = parameters self . _graph_parents = [ index_points , jitter ]
Instantiate a StudentTProcess Distribution.

    Args:
      df: Positive Floating-point `Tensor` representing the degrees of freedom.
        Must be greater than 2.
      kernel: `PositiveSemidefiniteKernel`-like instance representing the
        TP's covariance function.
      index_points: `float` `Tensor` representing finite (batch of) vector(s) of
        points in the index set over which the TP is defined. Shape has the form
        `[b1, ..., bB, e, f1, ..., fF]` where `F` is the number of feature
        dimensions and must equal `kernel.feature_ndims` and `e` is the number
        (size) of index points in each batch. Ultimately this distribution
        corresponds to a `e`-dimensional multivariate Student's T. The batch
        shape must be broadcastable with `kernel.batch_shape` and any batch dims
        yielded by `mean_fn`.
      mean_fn: Python `callable` that acts on `index_points` to produce a (batch
        of) vector(s) of mean values at `index_points`. Takes a `Tensor` of
        shape `[b1, ..., bB, f1, ..., fF]` and returns a `Tensor` whose shape is
        broadcastable with `[b1, ..., bB]`. Default value: `None` implies
        constant zero function.
      jitter: `float` scalar `Tensor` added to the diagonal of the covariance
        matrix to ensure positive definiteness of the covariance matrix.
        Default value: `1e-6`.
      validate_args: Python `bool`, default `False`. When `True` distribution
        parameters are checked for validity despite possibly degrading runtime
        performance. When `False` invalid inputs may silently render incorrect
        outputs.
        Default value: `False`.
      allow_nan_stats: Python `bool`, default `True`. When `True`,
        statistics (e.g., mean, mode, variance) use the value "`NaN`" to
        indicate the result is undefined. When `False`, an exception is raised
        if one or more of the statistic's batch members are undefined.
        Default value: `False`.
      name: Python `str` name prefixed to Ops created by this class.
        Default value: "StudentTProcess".

    Raises:
      ValueError: if `mean_fn` is not `None` and is not callable.