class_docstr: The interface of a mixin class.
docstr: Get an initialized optimizer.
  
  Parameters
  ----------
  optim_param
      Optimizer parameter. If a subclass instance of self.optim_class
      then we use this directly. If it is a callable then we call
      this (and pass the model through this call) and set the result
      of this call as the optimizer. If it is a string, we apply
      get_optimizer
  model
      initialized model
  name : str
      name of model, either "predictor" or "adversary"
docstr_tok: ["Get","an","initialized","optimizer",".","Parameters","--","--","--","--","--","optim_param","Optimizer","parameter",".","If","a","subclass","instance","of","self.optim_class","then","we","use","this","directly",".","If","it","is","a","callable","then","we","call","this","(","and","pass","the","model","through","this","call",")","and","set","the","result","of","this","call","as","the","optimizer",".","If","it","is","a","string",",","we","apply","get_optimizer","model","initialized","model","name",":","str","name","of","model",",","either","``","predictor","''","or","``","adversary","''"]
code: def __init_optimizers__(self, optim_param, model, name):
      """
      Get an initialized optimizer.
  
      Parameters
      ----------
      optim_param
          Optimizer parameter. If a subclass instance of self.optim_class
          then we use this directly. If it is a callable then we call
          this (and pass the model through this call) and set the result
          of this call as the optimizer. If it is a string, we apply
          get_optimizer
      model
          initialized model
      name : str
          name of model, either "predictor" or "adversary"
      """
      # Preinitialized optimizer
      if issubclass(type(optim_param), self.optim_class):
          return optim_param
      # Optimizer constructor
      elif callable(optim_param):
          return optim_param(model)
      # Optimizer keyword
      elif isinstance(optim_param, str):
          got_optim = self.get_optimizer(optim_param, model)
          if got_optim is None:
              raise ValueError(
                  _KWARG_ERROR_MESSAGE.format(
                      f"{name}_optimizer",
                      (
                          f"a string that is supported by {self.__name__}, "
                          + "an already initialized optimizer (must "
                          + f"subclass {self.optim_class}), or a constructor "
                          + f"that takes as parameter the {name}_model and "
                          + "returns an initialized optimizer."
                      ),
                  )
              )
          else:
              return got_optim
      # Invalid optim_param
      raise ValueError(
          _KWARG_ERROR_MESSAGE.format(
              f"{name}_optimizer",
              (
                  "a string that indicates a certain optimizer, "
                  + "an already initialized optimizer (must subclass "
                  + f"{self.optim_class}), or a constructor that takes "
                  + f"as parameter the {name}_model and returns an "
                  + "initialized optimizer."
              ),
          )
      )
  
file_path: fairlearn/fairlearn/adversarial/_backend_engine.py
imports: from ._constants import _KWARG_ERROR_MESSAGE, _NOT_IMPLEMENTED, _DIST_TYPE_NOT_IMPLEMENTED, _NO_LOSS, _LIST_MODEL_UNSUPPORTED
  from sklearn.utils import shuffle
  from numpy import ndarray
label_desc: Use image node_id 4 for calling the BackendEngine obj's underlying member method code with example usage: obj.__init_optimizers__(optim_param, model, name) and returns: optim_param, optim_param, got_optim