parameters: (self, shard_id, shard)
docstring: Defines the diagonal covariance probabilities per example in a class.
  
      Args:
        shard_id: id of the current shard.
        shard: current data shard, 1 X num_examples X dimensions.
  
      Returns a matrix num_examples * num_classes.
docstring_summary: Defines the diagonal covariance probabilities per example in a class.
docstring_tokens: Defines the diagonal covariance probabilities per example in a class .
function: def _define_diag_covariance_probs(self, shard_id, shard):
      """Defines the diagonal covariance probabilities per example in a class.
  
      Args:
        shard_id: id of the current shard.
        shard: current data shard, 1 X num_examples X dimensions.
  
      Returns a matrix num_examples * num_classes.
      """
      # num_classes X 1
      # TODO(xavigonzalvo): look into alternatives to log for
      # reparametrization of variance parameters.
      det_expanded = math_ops.reduce_sum(
          math_ops.log(self._covs + 1e-3), 1, keep_dims=True)
      diff = shard - self._means
      x2 = math_ops.square(diff)
      cov_expanded = array_ops.expand_dims(1.0 / (self._covs + 1e-3), 2)
      # num_classes X num_examples
      x2_cov = math_ops.matmul(x2, cov_expanded)
      x2_cov = array_ops.transpose(array_ops.squeeze(x2_cov, [2]))
      self._probs[shard_id] = -0.5 * (
          math_ops.to_float(self._dimensions) * math_ops.log(2.0 * np.pi) +
          array_ops.transpose(det_expanded) + x2_cov)
function_tokens: def _define_diag_covariance_probs ( self , shard_id , shard ) : # num_classes X 1 # TODO(xavigonzalvo): look into alternatives to log for # reparametrization of variance parameters. det_expanded = math_ops . reduce_sum ( math_ops . log ( self . _covs + 1e-3 ) , 1 , keep_dims = True ) diff = shard - self . _means x2 = math_ops . square ( diff ) cov_expanded = array_ops . expand_dims ( 1.0 / ( self . _covs + 1e-3 ) , 2 ) # num_classes X num_examples x2_cov = math_ops . matmul ( x2 , cov_expanded ) x2_cov = array_ops . transpose ( array_ops . squeeze ( x2_cov , [ 2 ] ) ) self . _probs [ shard_id ] = - 0.5 * ( math_ops . to_float ( self . _dimensions ) * math_ops . log ( 2.0 * np . pi ) + array_ops . transpose ( det_expanded ) + x2_cov )