code: def _should_keep_prediction(
      self,
      predicted_scores: List[OutputScore],
      actual_label: Optional[OutputScore],
  ) -> bool:
      # filter by class
      if len(self._config.classes) != 0:
          if not self._predictions_matches_labels(
              predicted_scores, self._config.classes
          ):
              return False
  
      if not actual_label:
          return True
  
      # filter by accuracy
      label_name = actual_label.label
      if self._config.prediction == "all":
          pass
      elif self._config.prediction == "correct":
          if not self._predictions_matches_labels(
              predicted_scores, label_name
          ):
              return False
      elif self._config.prediction == "incorrect":
          if self._predictions_matches_labels(
              predicted_scores, label_name
          ):
              return False
      else:
          raise Exception(
              f"Invalid prediction config: {self._config.prediction}"
          )
  
      return True
  
imports: from collections import namedtuple
  from itertools import cycle
  from typing import Any, Callable, Dict, Iterable, List, NamedTuple, Optional, Tuple, Union
  import torch
  from captum.attr import IntegratedGradients
  from captum.attr._utils.batching import _batched_generator
  from captum.insights.attr_vis.attribution_calculation import AttributionCalculation, OutputScore
  from captum.insights.attr_vis.config import ATTRIBUTION_METHOD_CONFIG, ATTRIBUTION_NAMES_TO_METHODS
  from captum.insights.attr_vis.features import BaseFeature
  from captum.insights.attr_vis.server import namedtuple_to_dict
  from captum.log import log_usage
  from torch import Tensor
  from torch.nn import Module
label_desc: Use image node_id 9 for calling the AttributionVisualizer obj's underlying member method code with example usage: obj._should_keep_prediction(predicted_scores, actual_label) and returns: True, True, False, False, False