Skip to content

Commit 982f5d7

Browse files
committed
Fix notebook + typing
Signed-off-by: abigailt <[email protected]>
1 parent d3af329 commit 982f5d7

File tree

3 files changed

+144
-80
lines changed

3 files changed

+144
-80
lines changed

art/metrics/privacy/membership_leakage.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
from art.utils import check_and_transform_label_format, is_probability_array
3131

3232
if TYPE_CHECKING:
33-
from art.estimators.classification.classifier import Classifier
33+
from art.utils import CLASSIFIER_TYPE
3434

3535

3636
class ComparisonType(Enum):
@@ -43,8 +43,8 @@ class ComparisonType(Enum):
4343

4444

4545
def PDTP( # pylint: disable=C0103
46-
target_estimator: "Classifier",
47-
extra_estimator: "Classifier",
46+
target_estimator: "CLASSIFIER_TYPE",
47+
extra_estimator: "CLASSIFIER_TYPE",
4848
x: np.ndarray,
4949
y: np.ndarray,
5050
indexes: Optional[np.ndarray] = None,
@@ -148,7 +148,7 @@ def PDTP( # pylint: disable=C0103
148148

149149

150150
def SHAPr( # pylint: disable=C0103
151-
target_estimator: "Classifier",
151+
target_estimator: "CLASSIFIER_TYPE",
152152
x_train: np.ndarray,
153153
y_train: np.ndarray,
154154
x_test: np.ndarray,

notebooks/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,12 @@ demonstrates a MembershipInferenceBlackBox membership inference attack using sha
104104
[label_only_membership_inference.ipynb](label_only_membership_inference.ipynb) [[on nbviewer](https://nbviewer.org/github/Trusted-AI/adversarial-robustness-toolbox/blob/main/notebooks/label_only_membership_inference.ipynb)]
105105
demonstrates a LabelOnlyDecisionBoundary membership inference attack on a PyTorch classifier for the MNIST dataset.
106106

107+
## Metrics
108+
109+
[privacy_metric.ipynb](privacy_metric.ipynb) [[on nbviewer](https://nbviewer.jupyter.org/github/Trusted-AI/adversarial-robustness-toolbox/blob/main/notebooks/privacy_metric.ipynb)]
110+
demonstrates how to apply both the PDTP and the SHAPr privacy metrics to random forest and decision tree classifiers
111+
trained on the nursery dataset.
112+
107113
## Classifiers
108114

109115
[classifier_blackbox.ipynb](classifier_blackbox.ipynb) [[on nbviewer](https://nbviewer.jupyter.org/github/Trusted-AI/adversarial-robustness-toolbox/blob/main/notebooks/classifier_blackbox.ipynb)] demonstrates BlackBoxClassifier, the most general and

0 commit comments

Comments
 (0)