Revision 458c6a6d1725c6d7b21773e762ceca01faa0bb23 authored by william cowley on 15 October 2021, 17:10:45 UTC, committed by william cowley on 15 October 2021, 17:10:45 UTC
1 parent 5e92b2e
model_utils.py
import tensorflow as tf
from ..base import Parameter
def add_noise_cov(K: tf.Tensor, likelihood_variance: Parameter) -> tf.Tensor:
"""
Returns K + σ² I, where σ² is the likelihood noise variance (scalar),
and I is the corresponding identity matrix.
"""
k_diag = tf.linalg.diag_part(K)
s_diag = tf.fill(tf.shape(k_diag), likelihood_variance)
return tf.linalg.set_diag(K, k_diag + s_diag)
Computing file changes ...