class_docstr: A class the mimicks the output of a classifier or regressor to
  allow testing of functionality that depends on it without
  inference overhead.
class_docstr_tok: ["A","class","the","mimicks","the","output","of","a","classifier","or","regressor","to","allow","testing","of","functionality","that","depends","on","it","without","inference","overhead","."]
docstr: Generates probability vectors by sampling from a Dirichlet distribution.
  User can specify the Dirichlet distribution parameters via the 'alpha'
  kwargs. See documentation for np.random.dirichlet  to see how to set
  this parameter.
  
  Parameters
  ----------
  sz
      Output dimension: [N, B] where N is number of batches and B is batch size.
docstr_tok: ["Generates","probability","vectors","by","sampling","from","a","Dirichlet","distribution",".","User","can","specify","the","Dirichlet","distribution","parameters","via","the","'alpha'","kwargs",".","See","documentation","for","np.random.dirichlet","to","see","how","to","set","this","parameter",".","Parameters","--","--","--","--","--","sz","Output","dimension",":","[","N",",","B","]","where","N","is","number","of","batches","and","B","is","batch","size","."]
code: def _generate_probas(
      self, sz: Optional[tuple] = None, *args, **kwargs
  ) -> np.ndarray:
      """
      Generates probability vectors by sampling from a Dirichlet distribution.
      User can specify the Dirichlet distribution parameters via the 'alpha'
      kwargs. See documentation for np.random.dirichlet  to see how to set
      this parameter.
  
      Parameters
      ----------
      sz
          Output dimension: [N, B] where N is number of batches and B is batch size.
      """
  
      if self.out_dim == 1:
          return np.random.uniform(size=sz)
  
      # set distribution parameters
      alpha = kwargs.get("alpha", np.ones(self.out_dim))
  
      if isinstance(alpha, np.ndarray):
          (dim,) = alpha.squeeze().shape
      elif isinstance(alpha, list):
          dim = len(alpha)
      else:
          raise TypeError(
              "Expected Dirichlet parameters to be of type list or np.ndarray!"
          )
  
      if dim != self.out_dim:
          raise ValueError(
              "The dimension of the Dirichlet distribution parameters"
              "must match output dimension. Got alpha dim={} and "
              "out_dim={} ".format(dim, self.out_dim)
          )
  
      return np.random.dirichlet(alpha, size=sz)
  
file_path: alibi/alibi/tests/utils.py
imports: from contextlib import contextmanager
  from typing import Optional
  import numpy
label_desc: Use image node_id 3 for calling the MockPredictor obj's underlying member method code with example usage: obj._generate_probas(sz) and returns: np, np