@@ -329,12 +329,12 @@ def __init__(self, estimator):
329329 @abc .abstractmethod
330330 def infer (self , x : np .ndarray , y : Optional [np .ndarray ] = None , ** kwargs ) -> np .ndarray :
331331 """
332- Infer sensitive properties ( attributes, membership training records) from the targeted estimator. This method
332+ Infer sensitive attributes from the targeted estimator. This method
333333 should be overridden by all concrete inference attack implementations.
334334
335335 :param x: An array with reference inputs to be used in the attack.
336336 :param y: Labels for `x`. This parameter is only used by some of the attacks.
337- :return: An array holding the inferred properties .
337+ :return: An array holding the inferred attribute values .
338338 """
339339 raise NotImplementedError
340340
@@ -358,12 +358,41 @@ def __init__(self, estimator, attack_feature: Union[int, slice] = 0):
358358 @abc .abstractmethod
359359 def infer (self , x : np .ndarray , y : Optional [np .ndarray ] = None , ** kwargs ) -> np .ndarray :
360360 """
361- Infer sensitive properties ( attributes, membership training records) from the targeted estimator. This method
361+ Infer sensitive attributes from the targeted estimator. This method
362362 should be overridden by all concrete inference attack implementations.
363363
364364 :param x: An array with reference inputs to be used in the attack.
365365 :param y: Labels for `x`. This parameter is only used by some of the attacks.
366- :return: An array holding the inferred properties.
366+ :return: An array holding the inferred attribute values.
367+ """
368+ raise NotImplementedError
369+
370+
371+ class MembershipInferenceAttack (InferenceAttack ):
372+ """
373+ Abstract base class for membership inference attack classes.
374+ """
375+
376+ def __init__ (self , estimator : Union ["CLASSIFIER_TYPE" ]):
377+ """
378+ :param estimator: A trained estimator targeted for inference attack.
379+ :type estimator: :class:`.art.estimators.estimator.BaseEstimator`
380+ :param attack_feature: The index of the feature to be attacked.
381+ """
382+ super ().__init__ (estimator )
383+
384+ @abc .abstractmethod
385+ def infer (self , x : np .ndarray , y : Optional [np .ndarray ] = None , ** kwargs ) -> np .ndarray :
386+ """
387+ Infer membership status of samples from the target estimator. This method
388+ should be overridden by all concrete inference attack implementations.
389+
390+ :param x: An array with reference inputs to be used in the attack.
391+ :param y: Labels for `x`. This parameter is only used by some of the attacks.
392+ :param probabilities: a boolean indicating whether to return the predicted probabilities per class, or just
393+ the predicted class.
394+ :return: An array holding the inferred membership status (1 indicates member of training set,
395+ 0 indicates non-member) or class probabilities.
367396 """
368397 raise NotImplementedError
369398
0 commit comments