class_docstr: Fast generalized subset scan based detector by McFowland, E., Speakman, S., and Neill, D. B. (2013).
  
  | Paper link: https://www.cs.cmu.edu/~neill/papers/mcfowland13a.pdf
class_docstr_tok: ["Fast","generalized","subset","scan","based","detector","by","McFowland",",","E.",",","Speakman",",","S.",",","and","Neill",",","D.","B",".","(","2013",")",".","|","Paper","link",":","https",":","\/\/www.cs.cmu.edu\/~neill\/papers\/mcfowland13a.pdf"]
docstr: Perform detection of adversarial data and return prediction as tuple.
  
  :param x: Data sample on which to perform detection.
  :param batch_size: Size of batches.
  :return: (report, is_adversarial):
          where report is a dictionary containing contains information specified by the subset scanning method;
          where is_adversarial is a boolean list of per-sample prediction whether the sample is adversarial
          or not and has the same `batch_size` (first dimension) as `x`.
docstr_tok: ["Perform","detection","of","adversarial","data","and","return","prediction","as","tuple",".",":","param","x",":","Data","sample","on","which","to","perform","detection",".",":","param","batch_size",":","Size","of","batches",".",":","return",":","(","report",",","is_adversarial",")",":","where","report","is","a","dictionary","containing","contains","information","specified","by","the","subset","scanning","method",";","where","is_adversarial","is","a","boolean","list","of","per-sample","prediction","whether","the","sample","is","adversarial","or","not","and","has","the","same","`","batch_size","`","(","first","dimension",")","as","`","x","`","."]
code: def detect(
      self, x: np.ndarray, batch_size: int = 128, **kwargs
  ) -> Tuple[dict, np.ndarray]:
      """
      Perform detection of adversarial data and return prediction as tuple.
  
      :param x: Data sample on which to perform detection.
      :param batch_size: Size of batches.
      :return: (report, is_adversarial):
              where report is a dictionary containing contains information specified by the subset scanning method;
              where is_adversarial is a boolean list of per-sample prediction whether the sample is adversarial
              or not and has the same `batch_size` (first dimension) as `x`.
      """
      pval_ranges = self._calculate_pvalue_ranges(x, batch_size)
      scores = []
  
      for pval_range in tqdm(
          pval_ranges, desc="Subset scanning", disable=not self.verbose
      ):
          best_score, _, _, _ = Scanner.fgss_individ_for_nets(
              pval_range, score_function=self.scoring_function
          )
          scores.append(best_score)
      scores_array = np.asarray(scores)
  
      is_adversarial = np.greater(scores_array, self.bgd_scores.max())
      report = {"scores": scores_array}
  
      return report, is_adversarial
  
file_path: adversarial-robustness-toolbox/art/defences/detector/evasion/subsetscanning/detector.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import logging
  import sys
  from typing import Optional, Tuple, Union, TYPE_CHECKING
  import numpy
  from sklearn import metrics
  from tqdm.auto import trange, tqdm
  from art.defences.detector.evasion.evasion_detector import EvasionDetector
  from art.defences.detector.evasion.subsetscanning.scanner import Scanner
  from art.defences.detector.evasion.subsetscanning.scoring_functions import ScoringFunctions
label_desc: Use image node_id 5 for calling the SubsetScanningDetector obj's underlying member method code with example usage: obj.detect(x, batch_size) and returns: report,  is_adversarial