original_docstring:  Extracts sample embeddings from model
  
      Parameters
      ----------
      vae_model : MultVAE
          Pretrained Multinomial VAE
      tree : skbio.TreeNode
          The tree used to train the VAE
      table : biom.Table
          The biom table one wishes to convert to sample embeddings
      return_type : str
          Options include 'tensor', 'array', 'dataframe' (default='tensor').
          If 'tensor' is specified, a `torch.Tensor` object is returned.
          If 'array' is specified, a `numpy.array` object is returned.
          If 'dataframe' is specified, a `pandas.DataFrame` object is returned.
      
docstring: Extracts sample embeddings from model
  Parameters
  
  
docstring_tokens: Extracts sample embeddings from model Parameters
code: def extract_sample_embeddings(vae_model, tree, table, return_type='dataframe'):
      """ Extracts sample embeddings from model
  
      Parameters
      ----------
      vae_model : MultVAE
          Pretrained Multinomial VAE
      tree : skbio.TreeNode
          The tree used to train the VAE
      table : biom.Table
          The biom table one wishes to convert to sample embeddings
      return_type : str
          Options include 'tensor', 'array', 'dataframe' (default='tensor').
          If 'tensor' is specified, a `torch.Tensor` object is returned.
          If 'array' is specified, a `numpy.array` object is returned.
          If 'dataframe' is specified, a `pandas.DataFrame` object is returned.
      """
      X = table.to_dataframe()
      tips = [n.name for n in tree.tips()]
      X = X.reindex(index=tips).fillna(0)
      X_embed = vae_model.to_latent(
          torch.Tensor(X.values.T).float())
      if return_type == 'tensor':
          return X_embed
      X_embed = X_embed.detach().cpu().numpy()
      if return_type == 'array':
          return X_embed
      elif return_type == 'dataframe':
          return pd.DataFrame(X_embed, index=table.ids(axis='sample'))
      else:
          ValueError(f'return type {return_type} is not supported.')
code_tokens: def extract_sample_embeddings ( vae_model , tree , table , return_type = 'dataframe' ) : X = table . to_dataframe ( ) tips = [ n . name for n in tree . tips ( ) ] X = X . reindex ( index = tips ) . fillna ( 0 ) X_embed = vae_model . to_latent ( torch . Tensor ( X . values . T ) . float ( ) ) if return_type == 'tensor' : return X_embed X_embed = X_embed . detach ( ) . cpu ( ) . numpy ( ) if return_type == 'array' : return X_embed elif return_type == 'dataframe' : return pd . DataFrame ( X_embed , index = table . ids ( axis = 'sample' ) ) else : ValueError ( f'return type {return_type} is not supported.' )
short_docstring: Extracts sample embeddings from model
  Parameters
short_docstring_tokens: Extracts sample embeddings from model Parameters
comment: """ Extracts sample embeddings from model
  
      Parameters
      ----------
      vae_model : MultVAE
          Pretrained Multinomial VAE
      tree : skbio.TreeNode
          The tree used to train the VAE
      table : biom.Table
          The biom table one wishes to convert to sample embeddings
      return_type : str
          Options include 'tensor', 'array', 'dataframe' (default='tensor').
          If 'tensor' is specified, a `torch.Tensor` object is returned.
          If 'array' is specified, a `numpy.array` object is returned.
          If 'dataframe' is specified, a `pandas.DataFrame` object is returned.
      """