class_docstr: An explainer class for instance-level explanations of Graph Neural
  Networks.
  
  Args:
      model (torch.nn.Module): The model to explain.
      algorithm (ExplainerAlgorithm): The explanation algorithm.
      explanation_type (ExplanationType or str): The type of explanation to
          compute. The possible values are:
  
              - :obj:`"model"`: Explains the model prediction.
  
              - :obj:`"phenomenon"`: Explains the phenomenon that the model
                is trying to predict.
  
          In practice, this means that the explanation algorithm will either
          compute their losses with respect to the model output
          (:obj:`"model"`) or the target output (:obj:`"phenomenon"`).
      model_config (ModelConfig): The model configuration.
          See :class:`~torch_geometric.explain.config.ModelConfig` for
          available options. (default: :obj:`None`)
      node_mask_type (MaskType or str, optional): The type of mask to apply
          on nodes. The possible values are (default: :obj:`None`):
  
              - :obj:`None`: Will not apply any mask on nodes.
  
              - :obj:`"object"`: Will mask each node.
  
              - :obj:`"common_attributes"`: Will mask each feature.
  
              - :obj:`"attributes"`: Will mask each feature across all nodes.
  
      edge_mask_type (MaskType or str, optional): The type of mask to apply
          on edges. Has the sample possible values as :obj:`node_mask_type`.
          (default: :obj:`None`)
      threshold_config (ThresholdConfig, optional): The threshold
          configuration.
          See :class:`~torch_geometric.explain.config.ThresholdConfig` for
          available options. (default: :obj:`None`)
class_docstr_tok: ["An","explainer","class","for","instance-level","explanations","of","Graph","Neural","Networks",".","Args",":","model","(","torch.nn.Module",")",":","The","model","to","explain",".","algorithm","(","ExplainerAlgorithm",")",":","The","explanation","algorithm",".","explanation_type","(","ExplanationType","or","str",")",":","The","type","of","explanation","to","compute",".","The","possible","values","are",":","-",":","obj",":","`","``","model","''","`",":","Explains","the","model","prediction",".","-",":","obj",":","`","``","phenomenon","''","`",":","Explains","the","phenomenon","that","the","model","is","trying","to","predict",".","In","practice",",","this","means","that","the","explanation","algorithm","will","either","compute","their","losses","with","respect","to","the","model","output","(",":","obj",":","`","``","model","''","`",")","or","the","target","output","(",":","obj",":","`","``","phenomenon","''","`",")",".","model_config","(","ModelConfig",")",":","The","model","configuration",".","See",":","class",":","`","~torch_geometric.explain.config.ModelConfig","`","for","available","options",".","(","default",":",":","obj",":","`","None","`",")","node_mask_type","(","MaskType","or","str",",","optional",")",":","The","type","of","mask","to","apply","on","nodes",".","The","possible","values","are","(","default",":",":","obj",":","`","None","`",")",":","-",":","obj",":","`","None","`",":","Will","not","apply","any","mask","on","nodes",".","-",":","obj",":","`","``","object","''","`",":","Will","mask","each","node",".","-",":","obj",":","`","``","common_attributes","''","`",":","Will","mask","each","feature",".","-",":","obj",":","`","``","attributes","''","`",":","Will","mask","each","feature","across","all","nodes",".","edge_mask_type","(","MaskType","or","str",",","optional",")",":","The","type","of","mask","to","apply","on","edges",".","Has","the","sample","possible","values","as",":","obj",":","`","node_mask_type","`",".","(","default",":",":","obj",":","`","None","`",")","threshold_config","(","ThresholdConfig",",","optional",")",":","The","threshold","configuration",".","See",":","class",":","`","~torch_geometric.explain.config.ThresholdConfig","`","for","available","options",".","(","default",":",":","obj",":","`","None","`",")"]
docstr: Returns the target of the model from a given prediction.
  
  If the model mode is of type :obj:`"regression"`, the prediction is
  returned as it is.
  If the model mode is of type :obj:`"multiclass_classification"` or
  :obj:`"binary_classification"`, the prediction is returned as the
  predicted class label.
docstr_tok: ["Returns","the","target","of","the","model","from","a","given","prediction",".","If","the","model","mode","is","of","type",":","obj",":","`","``","regression","''","`",",","the","prediction","is","returned","as","it","is",".","If","the","model","mode","is","of","type",":","obj",":","`","``","multiclass_classification","''","`","or",":","obj",":","`","``","binary_classification","''","`",",","the","prediction","is","returned","as","the","predicted","class","label","."]
code: def get_target(self, prediction: Tensor) -> Tensor:
      r"""Returns the target of the model from a given prediction.
  
      If the model mode is of type :obj:`"regression"`, the prediction is
      returned as it is.
      If the model mode is of type :obj:`"multiclass_classification"` or
      :obj:`"binary_classification"`, the prediction is returned as the
      predicted class label.
      """
      if self.model_config.mode == ModelMode.binary_classification:
          # TODO: Allow customization of the thresholds used below.
          if self.model_config.return_type == ModelReturnType.raw:
              return (prediction > 0).long().view(-1)
          if self.model_config.return_type == ModelReturnType.probs:
              return (prediction > 0.5).long().view(-1)
          assert False
  
      if self.model_config.mode == ModelMode.multiclass_classification:
          return prediction.argmax(dim=-1)
  
      return prediction
  
file_path: pytorch_geometric/torch_geometric/explain/explainer.py
imports: import warnings
  from typing import Any, Dict, Optional, Union
  import torch
  from torch import Tensor
  from torch_geometric.explain import ExplainerAlgorithm, Explanation, HeteroExplanation
  from torch_geometric.explain.algorithm.utils import clear_masks, set_hetero_masks, set_masks
  from torch_geometric.explain.config import ExplainerConfig, ExplanationType, MaskType, ModelConfig, ModelMode, ModelReturnType, ThresholdConfig
  from torch_geometric.typing import EdgeType, NodeType
label_desc: Use image node_id 5 for calling the Explainer obj's underlying member method code with example usage: obj.get_target(prediction) and returns: prediction, prediction, unknown, unknown