def _variance(self): if distribution_util.is_diagonal_scale(self.scale): return tf.square(self.scale.diag_part()) elif (isinstance(self.scale, tf.linalg.LinearOperatorLowRankUpdate) and self.scale.is_self_adjoint): return tf.linalg.diag_part(self.scale.matmul( self.scale.to_dense())) else: return tf.linalg.diag_part( self.scale.matmul(self.scale.to_dense(), adjoint_arg=True))
def _covariance(self): # Let # W = (w1,...,wk), with wj ~ iid Exponential(0, 1). # Then this distribution is # X = loc + LW, # and then since Cov(wi, wj) = 1 if i=j, and 0 otherwise, # Cov(X) = L Cov(W W^T) L^T = L L^T. if distribution_util.is_diagonal_scale(self.scale): return tf.linalg.diag(tf.square(self.scale.diag_part())) else: return self.scale.matmul(self.scale.to_dense(), adjoint_arg=True)
def _covariance(self): # Let # W = (w1,...,wk), with wj ~ iid Laplace(0, 1). # Then this distribution is # X = loc + LW, # and since E[X] = loc, # Cov(X) = E[LW W^T L^T] = L E[W W^T] L^T. # Since E[wi wj] = 0 if i != j, and 2 if i == j, we have # Cov(X) = 2 LL^T if distribution_util.is_diagonal_scale(self.scale): return 2. * tf.linalg.diag(tf.square(self.scale.diag_part())) else: return 2. * self.scale.matmul(self.scale.to_dense(), adjoint_arg=True)
def _covariance(self): if distribution_util.is_diagonal_scale(self.scale): return tf.linalg.diag(tf.square(self.scale.diag_part())) else: return self.scale.matmul(self.scale.to_dense(), adjoint_arg=True)