class_docstr: Class to compute the saliency maps based on the vanilla gradient w.r.t the adjacency and the feature matrix.
  
  Args:
      model (Keras model object): The differentiable graph model object.
          model.input should contain two tensors:
              - features (Numpy array): The placeholder of the feature matrix.
              - adj (Numpy array): The placeholder of the adjacency matrix.
          model.output (Keras tensor): The tensor of model prediction output.
              This is typically the logit or softmax output.
class_docstr_tok: ["Class","to","compute","the","saliency","maps","based","on","the","vanilla","gradient","w.r.t","the","adjacency","and","the","feature","matrix",".","Args",":","model","(","Keras","model","object",")",":","The","differentiable","graph","model","object",".","model.input","should","contain","two","tensors",":","-","features","(","Numpy","array",")",":","The","placeholder","of","the","feature","matrix",".","-","adj","(","Numpy","array",")",":","The","placeholder","of","the","adjacency","matrix",".","model.output","(","Keras","tensor",")",":","The","tensor","of","model","prediction","output",".","This","is","typically","the","logit","or","softmax","output","."]
docstr: This function computes the saliency maps (gradients) which measure the importance of each edge to the prediction score of 'class_of_interest'
  for node 'node_id'.
  
  Args:
      alpha (float): The path position parameter to support integrated gradient computation.
      node_id (int): The node ID in the StellarGraph object.
      class_of_interest (int): The  class of interest for which the saliency maps are computed.
      non_exist_edge (bool): Setting to True allows the function to get the importance for non-exist edges. This is useful when we want to understand
          adding which edges could change the current predictions. But the results for existing edges are not reliable. Simiarly, setting to False ((A_baseline = all zero matrix))
          could only accurately measure the importance of existing edges.
      X_val (Numpy array): The feature matrix, we do not directly get it from generator to support the integrated gradients computation.
      A_val (Numpy array): The adjacency matrix, we do not directly get it from generator to support the integrated gradients computation.
  Returns:
      gradients (Numpy array): Returns a vanilla gradient mask for the nodes.
docstr_tok: ["This","function","computes","the","saliency","maps","(","gradients",")","which","measure","the","importance","of","each","edge","to","the","prediction","score","of","'class_of_interest'","for","node","'node_id","'",".","Args",":","alpha","(","float",")",":","The","path","position","parameter","to","support","integrated","gradient","computation",".","node_id","(","int",")",":","The","node","ID","in","the","StellarGraph","object",".","class_of_interest","(","int",")",":","The","class","of","interest","for","which","the","saliency","maps","are","computed",".","non_exist_edge","(","bool",")",":","Setting","to","True","allows","the","function","to","get","the","importance","for","non-exist","edges",".","This","is","useful","when","we","want","to","understand","adding","which","edges","could","change","the","current","predictions",".","But","the","results","for","existing","edges","are","not","reliable",".","Simiarly",",","setting","to","False","(","(","A_baseline","=","all","zero","matrix",")",")","could","only","accurately","measure","the","importance","of","existing","edges",".","X_val","(","Numpy","array",")",":","The","feature","matrix",",","we","do","not","directly","get","it","from","generator","to","support","the","integrated","gradients","computation",".","A_val","(","Numpy","array",")",":","The","adjacency","matrix",",","we","do","not","directly","get","it","from","generator","to","support","the","integrated","gradients","computation",".","Returns",":","gradients","(","Numpy","array",")",":","Returns","a","vanilla","gradient","mask","for","the","nodes","."]
code: def get_link_masks(
      self,
      alpha,
      node_id,
      class_of_interest,
      non_exist_edge,
      X_val=None,
      A_val=None,
  ):
      """
      This function computes the saliency maps (gradients) which measure the importance of each edge to the prediction score of 'class_of_interest'
      for node 'node_id'.
  
      Args:
          alpha (float): The path position parameter to support integrated gradient computation.
          node_id (int): The node ID in the StellarGraph object.
          class_of_interest (int): The  class of interest for which the saliency maps are computed.
          non_exist_edge (bool): Setting to True allows the function to get the importance for non-exist edges. This is useful when we want to understand
              adding which edges could change the current predictions. But the results for existing edges are not reliable. Simiarly, setting to False ((A_baseline = all zero matrix))
              could only accurately measure the importance of existing edges.
          X_val (Numpy array): The feature matrix, we do not directly get it from generator to support the integrated gradients computation.
          A_val (Numpy array): The adjacency matrix, we do not directly get it from generator to support the integrated gradients computation.
      Returns:
          gradients (Numpy array): Returns a vanilla gradient mask for the nodes.
      """
      out_indices = np.array([[node_id]])
  
      if X_val is None:
          X_val = self.X
      if A_val is None:
          A_val = self.A
      # Execute the function to compute the gradient
      self.set_ig_values(alpha, non_exist_edge)
      if self.is_sparse and not sp.issparse(A_val):
          A_val = sp.lil_matrix(A_val)
      gradients = self.compute_link_gradients(
          [X_val, out_indices, A_val, 0, class_of_interest]
      )
      return gradients[0]
  
file_path: stellargraph/stellargraph/interpretability/saliency_maps/saliency_gat.py
imports: import numpy
  from tensorflow.keras import backend
  import scipy.sparse
  from stellargraph.mapper import FullBatchSequence
  import tensorflow
label_desc: Use image node_id 6 for calling the GradientSaliencyGAT obj's underlying member method code with example usage: obj.get_link_masks(alpha, node_id, class_of_interest, non_exist_edge, X_val, A_val) and returns: gradients