class_docstr: Implementation of Randomized Smoothing applied to classifier predictions and gradients, as introduced
  in Cohen et al. (2019).
  
  | Paper link: https://arxiv.org/abs/1902.02918
class_docstr_tok: ["Implementation","of","Randomized","Smoothing","applied","to","classifier","predictions","and","gradients",",","as","introduced","in","Cohen","et","al",".","(","2019",")",".","|","Paper","link",":","https",":","\/\/arxiv.org\/abs\/1902.02918"]
docstr: Computes certifiable radius around input `x` and returns radius `r` and prediction.
  
  :param x: Sample input with shape as expected by the model.
  :param n: Number of samples for estimate certifiable radius.
  :param batch_size: Batch size.
  :return: Tuple of length 2 of the selected class and certified radius.
docstr_tok: ["Computes","certifiable","radius","around","input","`","x","`","and","returns","radius","`","r","`","and","prediction",".",":","param","x",":","Sample","input","with","shape","as","expected","by","the","model",".",":","param","n",":","Number","of","samples","for","estimate","certifiable","radius",".",":","param","batch_size",":","Batch","size",".",":","return",":","Tuple","of","length","2","of","the","selected","class","and","certified","radius","."]
code: def certify(
      self, x: np.ndarray, n: int, batch_size: int = 32
  ) -> Tuple[np.ndarray, np.ndarray]:
      """
      Computes certifiable radius around input `x` and returns radius `r` and prediction.
  
      :param x: Sample input with shape as expected by the model.
      :param n: Number of samples for estimate certifiable radius.
      :param batch_size: Batch size.
      :return: Tuple of length 2 of the selected class and certified radius.
      """
      prediction = []
      radius = []
  
      for x_i in x:
          # get sample prediction for classification
          counts_pred = self._prediction_counts(
              x_i, n=self.sample_size, batch_size=batch_size
          )
          class_select = int(np.argmax(counts_pred))
  
          # get sample prediction for certification
          counts_est = self._prediction_counts(
              x_i, n=n, batch_size=batch_size
          )
          count_class = counts_est[class_select]
  
          prob_class = self._lower_confidence_bound(count_class, n)
  
          if prob_class < 0.5:
              prediction.append(-1)
              radius.append(0.0)
          else:
              prediction.append(class_select)
              radius.append(self.scale * norm.ppf(prob_class))
  
      return np.array(prediction), np.array(radius)
  
file_path: adversarial-robustness-toolbox/art/estimators/certification/randomized_smoothing/randomized_smoothing.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  from abc import ABC
  import logging
  from typing import Optional, Tuple
  import numpy
  from scipy.stats import norm
  from tqdm.auto import tqdm
  from art.config import ART_NUMPY_DTYPE
label_desc: Use image node_id 6 for calling the RandomizedSmoothingMixin obj's underlying member method code with example usage: obj.certify(x, n, batch_size) and returns: np,  np