class_docstr: A SaliencyMask class that implements the integrated gradients method.
class_docstr_tok: ["A","SaliencyMask","class","that","implements","the","integrated","gradients","method","."]
docstr: Args:
      model (Keras model object): The differentiable graph model object.
          For a dense model, the model.input should contain two tensors:
              - features: The placeholder of the feature matrix.
              - adj: The placeholder of the adjacency matrix.
          For a sparse model, the model.input should contain three tensors:
              - features: The placeholder of the feature matrix.
              - adj_index: The placeholder of the adjacency matrix.
              - adj_values: The placeholder of the adjacency matrix.
          The model.output (Keras tensor) is the tensor of model prediction output.
              This is typically the logit or softmax output.
docstr_tok: ["Args",":","model","(","Keras","model","object",")",":","The","differentiable","graph","model","object",".","For","a","dense","model",",","the","model.input","should","contain","two","tensors",":","-","features",":","The","placeholder","of","the","feature","matrix",".","-","adj",":","The","placeholder","of","the","adjacency","matrix",".","For","a","sparse","model",",","the","model.input","should","contain","three","tensors",":","-","features",":","The","placeholder","of","the","feature","matrix",".","-","adj_index",":","The","placeholder","of","the","adjacency","matrix",".","-","adj_values",":","The","placeholder","of","the","adjacency","matrix",".","The","model.output","(","Keras","tensor",")","is","the","tensor","of","model","prediction","output",".","This","is","typically","the","logit","or","softmax","output","."]
code: def __init__(self, model, generator):
      """
      Args:
          model (Keras model object): The differentiable graph model object.
              For a dense model, the model.input should contain two tensors:
                  - features: The placeholder of the feature matrix.
                  - adj: The placeholder of the adjacency matrix.
              For a sparse model, the model.input should contain three tensors:
                  - features: The placeholder of the feature matrix.
                  - adj_index: The placeholder of the adjacency matrix.
                  - adj_values: The placeholder of the adjacency matrix.
              The model.output (Keras tensor) is the tensor of model prediction output.
                  This is typically the logit or softmax output.
  
      """
      # Set sparse flag from the generator
      self._is_sparse = generator.use_sparse
  
      if self._is_sparse:
          if not isinstance(generator, SparseFullBatchSequence):
              raise TypeError(
                  "The generator supplied has to be an object of SparseFullBatchSequence for sparse adjacency matrix."
              )
          if len(model.input) != 4:
              raise RuntimeError(
                  "Keras model for sparse adjacency is expected to have four inputs"
              )
          self._adj = generator.A_values
          self._adj_inds = generator.A_indices
      else:
          if not isinstance(generator, FullBatchSequence):
              raise TypeError(
                  "The generator supplied has to be an object of FullBatchSequence for dense adjacency matrix."
              )
          if len(model.input) != 3:
              raise RuntimeError(
                  "Keras model for dense adjacency is expected to have three inputs"
              )
  
          self._adj = generator.A_dense
  
      # Extract features from generator
      self._features = generator.features
      self._model = model
  
file_path: stellargraph/stellargraph/interpretability/saliency_maps/integrated_gradients.py
imports: import numpy
  from tensorflow.keras import backend
  from scipy.sparse import csr_matrix
  import tensorflow
  from stellargraph.mapper import SparseFullBatchSequence, FullBatchSequence
label_desc: Use image node_id 1 to create a new IntegratedGradients object  with example: obj = IntegratedGradients(model, generator)