class_docstr: The multiomics data for creating sparse graph dataset based on the settings in the MOGONET paper.
  
  Args:
      root (string): Root directory where the dataset should be saved.
      raw_file_names (list[callable], optional): The name of the files in the ``self.raw_dir`` folder that must be
          present in order to skip downloading.
      num_modalities (int): The total number of modalities in the dataset.
      num_classes (int): The total number of classes in the dataset.
      edge_per_node (int): Predefined number of edges per nodes in computing adjacency matrix.
      url (string, optional): The url to download the dataset from.
      random_split (bool, optional): Whether to split the dataset into random train and test subsets. (default:
          ``False``)
      train_size (float, optional): The proportion of the dataset to include in the train split that should be between
          0.0 and 1.0. This parameter is used when ``random_split`` is ``True``.
      equal_weight (bool, optional): Whether to use equal weights for all samples. (default: ``False``)
      transform (callable, optional): A function/transform that takes in an array_like data and returns a transformed
          version. The data object will be transformed before every access. (default: ``None``)
      pre_transform (callable, optional): A function/transform that takes in an array_like data and returns a
          transformed version. The data object will be transformed before being saved to disk. (default: ``None``)
      target_pre_transform (callable, optional): A function/transform that takes in an array_like of labels and
          returns a transformed version. The label object will be transformed before being saved to disk. (default:
          ``None``)
class_docstr_tok: ["The","multiomics","data","for","creating","sparse","graph","dataset","based","on","the","settings","in","the","MOGONET","paper",".","Args",":","root","(","string",")",":","Root","directory","where","the","dataset","should","be","saved",".","raw_file_names","(","list","[","callable","]",",","optional",")",":","The","name","of","the","files","in","the","``","self.raw_dir","``","folder","that","must","be","present","in","order","to","skip","downloading",".","num_modalities","(","int",")",":","The","total","number","of","modalities","in","the","dataset",".","num_classes","(","int",")",":","The","total","number","of","classes","in","the","dataset",".","edge_per_node","(","int",")",":","Predefined","number","of","edges","per","nodes","in","computing","adjacency","matrix",".","url","(","string",",","optional",")",":","The","url","to","download","the","dataset","from",".","random_split","(","bool",",","optional",")",":","Whether","to","split","the","dataset","into","random","train","and","test","subsets",".","(","default",":","``","False","``",")","train_size","(","float",",","optional",")",":","The","proportion","of","the","dataset","to","include","in","the","train","split","that","should","be","between","0.0","and","1.0",".","This","parameter","is","used","when","``","random_split","``","is","``","True","``",".","equal_weight","(","bool",",","optional",")",":","Whether","to","use","equal","weights","for","all","samples",".","(","default",":","``","False","``",")","transform","(","callable",",","optional",")",":","A","function\/transform","that","takes","in","an","array_like","data","and","returns","a","transformed","version",".","The","data","object","will","be","transformed","before","every","access",".","(","default",":","``","None","``",")","pre_transform","(","callable",",","optional",")",":","A","function\/transform","that","takes","in","an","array_like","data","and","returns","a","transformed","version",".","The","data","object","will","be","transformed","before","being","saved","to","disk",".","(","default",":","``","None","``",")","target_pre_transform","(","callable",",","optional",")",":","A","function\/transform","that","takes","in","an","array_like","of","labels","and","returns","a","transformed","version",".","The","label","object","will","be","transformed","before","being","saved","to","disk",".","(","default",":","``","None","``",")"]
docstr: Calculate a sparse adjacency matrix of the input dataset defined by edge indices and edge attributes.
  
  Args:
      train_data (torch.Tensor): The training data.
      test_data (torch.Tensor, optional): The test data. If ''None'' then the adjacency matrix is only calculated
          on the train data. (default: ``None``)
      train (bool, optional): Whether to use only train data to calculate the adjacency matrix. If ''False'' then
          the entire dataset (training and test sets) is used. (default: ``True``)
      eps (float, optional): Small value to avoid division by zero. (default: 1e-8)
      metric (DistanceMetric, optional): The metric to compute distance between input matrices. (default:
          ``DistanceMetric.COSINE``)
  
  Returns:
      A tuple of edge indices and edge attributes.
docstr_tok: ["Calculate","a","sparse","adjacency","matrix","of","the","input","dataset","defined","by","edge","indices","and","edge","attributes",".","Args",":","train_data","(","torch.Tensor",")",":","The","training","data",".","test_data","(","torch.Tensor",",","optional",")",":","The","test","data",".","If","``","None","''","then","the","adjacency","matrix","is","only","calculated","on","the","train","data",".","(","default",":","``","None","``",")","train","(","bool",",","optional",")",":","Whether","to","use","only","train","data","to","calculate","the","adjacency","matrix",".","If","``","False","''","then","the","entire","dataset","(","training","and","test","sets",")","is","used",".","(","default",":","``","True","``",")","eps","(","float",",","optional",")",":","Small","value","to","avoid","division","by","zero",".","(","default",":","1e-8",")","metric","(","DistanceMetric",",","optional",")",":","The","metric","to","compute","distance","between","input","matrices",".","(","default",":","``","DistanceMetric.COSINE","``",")","Returns",":","A","tuple","of","edge","indices","and","edge","attributes","."]
code: def _get_adjacency_info(
      self,
      train_data: torch.Tensor,
      test_data: torch.Tensor = None,
      train: bool = True,
      eps: float = 1e-8,
      metric: DistanceMetric = DistanceMetric.COSINE,
  ) -> Tuple:
      """Calculate a sparse adjacency matrix of the input dataset defined by edge indices and edge attributes.
  
      Args:
          train_data (torch.Tensor): The training data.
          test_data (torch.Tensor, optional): The test data. If ''None'' then the adjacency matrix is only calculated
              on the train data. (default: ``None``)
          train (bool, optional): Whether to use only train data to calculate the adjacency matrix. If ''False'' then
              the entire dataset (training and test sets) is used. (default: ``True``)
          eps (float, optional): Small value to avoid division by zero. (default: 1e-8)
          metric (DistanceMetric, optional): The metric to compute distance between input matrices. (default:
              ``DistanceMetric.COSINE``)
  
      Returns:
          A tuple of edge indices and edge attributes.
      """
      num_train = train_data.shape[0]
      num_test = 0 if test_data is None else test_data.shape[0]
      if train:
          adj_matrix = calculate_distance(
              train_data, eps=eps, metric=metric
          )
          self._find_sim_threshold(adj_matrix, num_train)
          non_zero_entries = self._generate_sparse_adj(
              adj_matrix, self_loop=train
          )
          adj_matrix = torch.mul(adj_matrix, non_zero_entries)
      else:
          adj_matrix = torch.zeros(
              (num_train + num_test, num_train + num_test)
          )
          dist = calculate_distance(
              train_data, test_data, eps=eps, metric=metric
          )
          non_zero_entries = self._generate_sparse_adj(
              dist, self_loop=train
          )
          adj_matrix[:num_train, num_train:] = torch.mul(
              dist, non_zero_entries
          )
  
          dist = calculate_distance(
              test_data, train_data, eps=eps, metric=metric
          )
          non_zero_entries = self._generate_sparse_adj(
              dist, self_loop=train
          )
          adj_matrix[num_train:, :num_train] = torch.mul(
              dist, non_zero_entries
          )
  
      adj_matrix_trans = adj_matrix.transpose(0, 1)
      adj_matrix = (
          adj_matrix
          + adj_matrix_trans * (adj_matrix_trans > adj_matrix).float()
          - adj_matrix * (adj_matrix_trans > adj_matrix).float()
      )
      identity_mat = torch.eye(
          adj_matrix.shape[0], device=adj_matrix.device
      )
      adj_matrix = F.normalize(adj_matrix + identity_mat, p=1)
      adj_matrix = adj_matrix.to_sparse()
  
      return adj_matrix.indices(), adj_matrix.values()
  
imports: import os.path
  from typing import Callable, List, Optional, Tuple, Union
  import numpy
  import torch
  import torch.nn.functional
  from torch_geometric.data import Data, Dataset, download_url, extract_zip
  from torch_sparse import SparseTensor
  from kale.utils.distance import calculate_distance, DistanceMetric
label_desc: Use image node_id 3 for calling the SparseMultiomicsDataset obj's underlying member method code with example usage: obj._get_adjacency_info(train_data, test_data, train, eps, metric) and returns: adj_matrix,  adj_matrix