class_docstr: Base class for training attack models.
  
  Attributes:
    backend: Name of Scikit-Learn parallel backend to use for this attack
      model. The default value of `None` performs single-threaded training.
    model: The trained attack model.
    ctx_mgr: The backend context manager within which to perform training.
      Defaults to the null context manager for single-threaded training.
    n_jobs: Number of jobs that can run in parallel when using a backend.
      Set to `1` for single-threading, and to `-1` for all parallel
      backends.
code: def __init__(self, backend: Optional[str] = None):
      self.model = None
      self.backend = backend
      if backend is None:
          # Default value of `None` will perform single-threaded training.
          self.ctx_mgr = contextlib.nullcontext()
          self.n_jobs = 1
          logging.info("Using single-threaded backend for training.")
      else:
          self.n_jobs = -1
          self.ctx_mgr = parallel_backend(
              # Values for 'backend': `loky`, `threading`, `multiprocessing`.
              # Can also use `dask`, `distributed`, `ray` if they are installed.
              backend=backend,
              n_jobs=self.n_jobs,
          )
          logging.info("Using %s backend for training.", backend)
  
imports: import contextlib
  import dataclasses
  import logging
  from typing import Optional
  import numpy
  from sklearn import ensemble
  from sklearn import linear_model
  from sklearn import model_selection
  from sklearn import neighbors
  from sklearn import neural_network
  from sklearn.utils import parallel_backend
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack import data_structures
label_desc: Use image node_id 1 to create a new TrainedAttacker object from inherited base classes: object with example: obj = TrainedAttacker(backend)