class_docstr: Class for the Wald space, a metric space for phylogenetic forests.
  
  Parameters
  ----------
  n_labels : int
      Integer determining the number of labels in the forests, and thus the shape of
      the correlation matrices: n_labels x n_labels.
  
  Attributes
  ----------
  ambient :
      The ambient space, the positive definite n_labels x n_labels matrices that the
      WaldSpace is embedded into.
class_docstr_tok: ["Class","for","the","Wald","space",",","a","metric","space","for","phylogenetic","forests",".","Parameters","--","--","--","--","--","n_labels",":","int","Integer","determining","the","number","of","labels","in","the","forests",",","and","thus","the","shape","of","the","correlation","matrices",":","n_labels","x","n_labels",".","Attributes","--","--","--","--","--","ambient",":","The","ambient","space",",","the","positive","definite","n_labels","x","n_labels","matrices","that","the","WaldSpace","is","embedded","into","."]
docstr: Sample a random point in Wald space.
  
  Parameters
  ----------
  n_samples : int
      Number of samples. Defaults to 1.
  p_tree : float between 0 and 1
      The probability that the sampled point is a tree, and not a forest. If the
      probability is equal to 1, then the sampled point will be a tree.
      Defaults to 0.9.
  p_keep : float between 0 and 1
      The probability that a sampled edge is kept and not deleted randomly.
      To be precise, it is not exactly the probability, as some edges cannot be
      deleted since the requirement that two labels are separated by a split might
      be violated otherwise.
      Defaults to 0.9
  btol: float
      Tolerance for the boundary of the coordinates in each grove. Defaults to
      1e-08.
  
  Returns
  -------
  samples : Wald or list of Wald, shape=[n_samples]
      Points sampled in Wald space.
code: def random_point(
      self, n_samples=1, p_tree=0.9, p_keep=0.9, btol=1e-08
  ):
      """Sample a random point in Wald space.
  
      Parameters
      ----------
      n_samples : int
          Number of samples. Defaults to 1.
      p_tree : float between 0 and 1
          The probability that the sampled point is a tree, and not a forest. If the
          probability is equal to 1, then the sampled point will be a tree.
          Defaults to 0.9.
      p_keep : float between 0 and 1
          The probability that a sampled edge is kept and not deleted randomly.
          To be precise, it is not exactly the probability, as some edges cannot be
          deleted since the requirement that two labels are separated by a split might
          be violated otherwise.
          Defaults to 0.9
      btol: float
          Tolerance for the boundary of the coordinates in each grove. Defaults to
          1e-08.
  
      Returns
      -------
      samples : Wald or list of Wald, shape=[n_samples]
          Points sampled in Wald space.
      """
      p_new = p_tree ** (1 / (self.n_labels - 1))
      sample = [
          Wald.generate_wald(
              self.n_labels, p_keep, p_new, btol, check=True
          )
          for _ in range(n_samples)
      ]
      return sample
  
imports: import functools
  import itertools
  import geomstats.backend
  import geomstats.geometry.spd_matrices
  from geomstats.geometry.stratified.point_set import Point, PointSet, _vectorize_point
label_desc: Use image node_id 3 for calling the WaldSpace obj's underlying member method code with example usage: obj.random_point(n_samples, p_tree, p_keep, btol) and returns: sample