class_docstr: Still under development.
class_docstr_tok: ["Still","under","development","."]
docstr: Sample from the probability distribution.
  
  This method will return `n` samples generated from the underlying
  probability distribution. For a mixture model, this involves first
  sampling the component using the prior probabilities, and then sampling
  from the chosen distribution.
  
  
  Parameters
  ----------
  n: int
          The number of samples to generate.
  
  X: list, numpy.ndarray, torch.tensor, shape=(n, d, *self.probs.shape-1) 
          The values to be conditioned on when generating the samples.
  
  Returns
  -------
  X: torch.tensor, shape=(n, self.d)
          Randomly generated samples.
docstr_tok: ["Sample","from","the","probability","distribution",".","This","method","will","return","`","n","`","samples","generated","from","the","underlying","probability","distribution",".","For","a","mixture","model",",","this","involves","first","sampling","the","component","using","the","prior","probabilities",",","and","then","sampling","from","the","chosen","distribution",".","Parameters","--","--","--","--","--","n",":","int","The","number","of","samples","to","generate",".","X",":","list",",","numpy.ndarray",",","torch.tensor",",","shape=","(","n",",","d",",","*","self.probs.shape-1",")","The","values","to","be","conditioned","on","when","generating","the","samples",".","Returns","--","--","--","-","X",":","torch.tensor",",","shape=","(","n",",","self.d",")","Randomly","generated","samples","."]
code: def sample(self, n, X):
      """Sample from the probability distribution.
  
      This method will return `n` samples generated from the underlying
      probability distribution. For a mixture model, this involves first
      sampling the component using the prior probabilities, and then sampling
      from the chosen distribution.
  
  
      Parameters
      ----------
      n: int
              The number of samples to generate.
  
      X: list, numpy.ndarray, torch.tensor, shape=(n, d, *self.probs.shape-1)
              The values to be conditioned on when generating the samples.
  
      Returns
      -------
      X: torch.tensor, shape=(n, self.d)
              Randomly generated samples.
      """
  
      X = _check_parameter(
          _cast_as_tensor(X),
          "X",
          ndim=3,
          shape=(-1, self.n_parents - 1, self.d),
      )
  
      y = []
      for i in range(n):
          y.append([])
  
          for j in range(self.d):
              idx = tuple(X[i, :, j])
              if len(idx) == 1:
                  idx = idx[0].item()
  
              probs = self.probs[j][idx]
  
              y_ = torch.multinomial(probs, 1).item()
              y[-1].append(y_)
  
      return torch.tensor(y)
  
file_path: pomegranate/pomegranate/distributions/conditional_categorical.py
imports: import numpy
  import torch
  import itertools
  from .._utils import _cast_as_tensor
  from .._utils import _cast_as_parameter
  from .._utils import _update_parameter
  from .._utils import _check_parameter
  from .._utils import _reshape_weights
  from .._utils import BufferList
  from ._distribution import ConditionalDistribution
  from .categorical import Categorical
label_desc: Use image node_id 4 for calling the ConditionalCategorical obj's underlying member method code with example usage: obj.sample(n, X) and returns: torch