class_docstr: Implementation of a learned black-box membership inference attack.
  
  This implementation can use as input to the learning process probabilities/logits or losses,
  depending on the type of model and provided configuration.
docstr: Create a MembershipInferenceBlackBox attack instance.
  
  :param estimator: Target estimator.
  :param attack_model_type: the type of default attack model to train, optional. Should be one of:
                           `nn` (neural network, default),
                           `rf` (random forest),
                           `gb` (gradient boosting),
                           `lr` (logistic regression),
                           `dt` (decision tree),
                           `knn` (k nearest neighbors),
                           `svm` (support vector machine).
                           If `attack_model` is supplied, this option will be ignored.
  :param input_type: the type of input to train the attack on. Can be one of: 'prediction' or 'loss'. Default is
                     `prediction`. Predictions can be either probabilities or logits, depending on the return type
                     of the model. If the model is a regressor, only `loss` can be used.
  :param attack_model: The attack model to train, optional. If none is provided, a default model will be created.
  :param nn_model_epochs: the number of epochs to use when training a nn attack model
  :param nn_model_batch_size: the batch size to use when training a nn attack model
  :param nn_model_learning_rate: the learning rate to use when training a nn attack model
docstr_tok: ["Create","a","MembershipInferenceBlackBox","attack","instance",".",":","param","estimator",":","Target","estimator",".",":","param","attack_model_type",":","the","type","of","default","attack","model","to","train",",","optional",".","Should","be","one","of",":","`","nn","`","(","neural","network",",","default",")",",","`","rf","`","(","random","forest",")",",","`","gb","`","(","gradient","boosting",")",",","`","lr","`","(","logistic","regression",")",",","`","dt","`","(","decision","tree",")",",","`","knn","`","(","k","nearest","neighbors",")",",","`","svm","`","(","support","vector","machine",")",".","If","`","attack_model","`","is","supplied",",","this","option","will","be","ignored",".",":","param","input_type",":","the","type","of","input","to","train","the","attack","on",".","Can","be","one","of",":","'prediction","'","or","'loss","'",".","Default","is","`","prediction","`",".","Predictions","can","be","either","probabilities","or","logits",",","depending","on","the","return","type","of","the","model",".","If","the","model","is","a","regressor",",","only","`","loss","`","can","be","used",".",":","param","attack_model",":","The","attack","model","to","train",",","optional",".","If","none","is","provided",",","a","default","model","will","be","created",".",":","param","nn_model_epochs",":","the","number","of","epochs","to","use","when","training","a","nn","attack","model",":","param","nn_model_batch_size",":","the","batch","size","to","use","when","training","a","nn","attack","model",":","param","nn_model_learning_rate",":","the","learning","rate","to","use","when","training","a","nn","attack","model"]
code: def __init__(
      self,
      estimator: Union["CLASSIFIER_TYPE", "REGRESSOR_TYPE"],
      input_type: str = "prediction",
      attack_model_type: str = "nn",
      attack_model: Optional[Any] = None,
      nn_model_epochs: int = 100,
      nn_model_batch_size: int = 100,
      nn_model_learning_rate: float = 0.0001,
  ):
      """
      Create a MembershipInferenceBlackBox attack instance.
  
      :param estimator: Target estimator.
      :param attack_model_type: the type of default attack model to train, optional. Should be one of:
                               `nn` (neural network, default),
                               `rf` (random forest),
                               `gb` (gradient boosting),
                               `lr` (logistic regression),
                               `dt` (decision tree),
                               `knn` (k nearest neighbors),
                               `svm` (support vector machine).
                               If `attack_model` is supplied, this option will be ignored.
      :param input_type: the type of input to train the attack on. Can be one of: 'prediction' or 'loss'. Default is
                         `prediction`. Predictions can be either probabilities or logits, depending on the return type
                         of the model. If the model is a regressor, only `loss` can be used.
      :param attack_model: The attack model to train, optional. If none is provided, a default model will be created.
      :param nn_model_epochs: the number of epochs to use when training a nn attack model
      :param nn_model_batch_size: the batch size to use when training a nn attack model
      :param nn_model_learning_rate: the learning rate to use when training a nn attack model
      """
  
      super().__init__(estimator=estimator)
      self.input_type = input_type
      self.attack_model_type = attack_model_type
      self.attack_model = attack_model
      self.epochs = nn_model_epochs
      self.batch_size = nn_model_batch_size
      self.learning_rate = nn_model_learning_rate
      self.use_label = True
  
      self._regressor_model = (
          RegressorMixin in type(self.estimator).__mro__
      )
  
      self._check_params()
  
      if self.attack_model:
          self.default_model = False
          self.attack_model_type = "None"
      else:
          self.default_model = True
  
          if self.attack_model_type == "rf":
              self.attack_model = RandomForestClassifier()
          elif self.attack_model_type == "gb":
              self.attack_model = GradientBoostingClassifier()
          elif self.attack_model_type == "lr":
              self.attack_model = LogisticRegression()
          elif self.attack_model_type == "dt":
              self.attack_model = DecisionTreeClassifier()
          elif self.attack_model_type == "knn":
              self.attack_model = KNeighborsClassifier()
          elif self.attack_model_type == "svm":
              self.attack_model = SVC(probability=True)
          elif attack_model_type != "nn":
              raise ValueError(
                  "Illegal value for parameter `attack_model_type`."
              )
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import logging
  from typing import Any, Optional, Union, TYPE_CHECKING
  import numpy
  from sklearn.ensemble import RandomForestClassifier, GradientBoostingClassifier
  from sklearn.linear_model import LogisticRegression
  from sklearn.neighbors import KNeighborsClassifier
  from sklearn.tree import DecisionTreeClassifier
  from sklearn.svm import SVC
  from art.attacks.attack import MembershipInferenceAttack
  from art.estimators.estimator import BaseEstimator
  from art.estimators.classification.classifier import ClassifierMixin
  from art.estimators.regression import RegressorMixin
  from art.utils import check_and_transform_label_format
label_desc: Use image node_id 1 to create a new MembershipInferenceBlackBox object from inherited base classes: MembershipInferenceAttack with example: obj = MembershipInferenceBlackBox(estimator, input_type, attack_model_type, attack_model, nn_model_epochs, nn_model_batch_size, nn_model_learning_rate)