def _stddev(self):
   if distribution_util.is_diagonal_scale(self.scale):
     return np.sqrt(2) * math_ops.abs(self.scale.diag_part())
   elif (isinstance(self.scale, linalg.LinearOperatorUDVHUpdate)
         and self.scale.is_self_adjoint):
     return np.sqrt(2) * math_ops.sqrt(array_ops.matrix_diag_part(
         self.scale.matmul(self.scale.to_dense())))
   else:
     return np.sqrt(2) * math_ops.sqrt(array_ops.matrix_diag_part(
         self.scale.matmul(self.scale.to_dense(), adjoint_arg=True)))
Ejemplo n.º 2
0
 def _variance(self):
   if distribution_util.is_diagonal_scale(self.scale):
     return math_ops.square(self.scale.diag_part())
   elif (isinstance(self.scale, linalg.LinearOperatorLowRankUpdate) and
         self.scale.is_self_adjoint):
     return array_ops.matrix_diag_part(
         self.scale.matmul(self.scale.to_dense()))
   else:
     return array_ops.matrix_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 array_ops.matrix_diag(math_ops.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. * array_ops.matrix_diag(math_ops.square(self.scale.diag_part()))
   else:
     return 2. * self.scale.matmul(self.scale.to_dense(), adjoint_arg=True)
 def _stddev(self):
     if distribution_util.is_diagonal_scale(self.scale):
         return np.sqrt(2) * math_ops.abs(self.scale.diag_part())
     elif (isinstance(self.scale, linalg.LinearOperatorLowRankUpdate)
           and self.scale.is_self_adjoint):
         return np.sqrt(2) * math_ops.sqrt(
             array_ops.matrix_diag_part(
                 self.scale.matmul(self.scale.to_dense())))
     else:
         return np.sqrt(2) * math_ops.sqrt(
             array_ops.matrix_diag_part(
                 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. * array_ops.matrix_diag(math_ops.square(self.scale.diag_part()))
   else:
     return 2. * self.scale.matmul(self.scale.to_dense(), adjoint_arg=True)
Ejemplo n.º 7
0
 def _covariance(self):
   if distribution_util.is_diagonal_scale(self.scale):
     return array_ops.matrix_diag(math_ops.square(self.scale.diag_part()))
   else:
     return self.scale.matmul(self.scale.to_dense(), adjoint_arg=True)
Ejemplo n.º 8
0
 def _covariance(self):
   if distribution_util.is_diagonal_scale(self.scale):
     return array_ops.matrix_diag(math_ops.square(self.scale.diag_part()))
   else:
     return self.scale.matmul(self.scale.to_dense(), adjoint_arg=True)