Skip to content

Commit f4a8928

Browse files
author
Beat Buesser
committed
Update documentation
Signed-off-by: Beat Buesser <[email protected]>
1 parent 02bfa81 commit f4a8928

File tree

15 files changed

+118
-20
lines changed

15 files changed

+118
-20
lines changed

art/attacks/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
Module providing adversarial attacks under a common interface.
33
"""
44
from art.attacks.attack import Attack, EvasionAttack, PoisoningAttack, PoisoningAttackBlackBox, PoisoningAttackWhiteBox
5-
from art.attacks.attack import ExtractionAttack, InferenceAttack, AttributeInferenceAttack
5+
from art.attacks.attack import PoisoningAttackTransformer, ExtractionAttack, InferenceAttack, AttributeInferenceAttack

art/attacks/evasion/pixel_threshold.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
# In the meantime, the modified implementation is used which is defined in the
4040
# lines `453-1457`.
4141

42-
from scipy._lib.six import xrange, string_types
42+
from six import string_types
4343
from scipy._lib._util import check_random_state
4444
from scipy.optimize.optimize import _status_message
4545
from scipy.optimize import OptimizeResult, minimize
@@ -1129,7 +1129,7 @@ def solve(self):
11291129
self._calculate_population_energies()
11301130

11311131
# do the optimisation.
1132-
for nit in xrange(1, self.maxiter + 1):
1132+
for nit in range(1, self.maxiter + 1):
11331133
# evolve the population by a generation
11341134
try:
11351135
next(self)

art/attacks/poisoning/adversarial_embedding_attack.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ def poison_estimator(
250250
def get_training_data(self) -> Optional[Tuple[np.ndarray, np.ndarray, np.ndarray]]:
251251
"""
252252
Returns the training data generated from the last call to fit
253+
253254
:return: If fit has been called, return the last data, labels, and backdoor labels used to train model
254255
otherwise return None
255256
"""

art/defences/preprocessor/spatial_smoothing_pytorch.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@
3232

3333
import numpy as np
3434

35-
from art.utils import CLIP_VALUES_TYPE
3635
from art.defences.preprocessor.preprocessor import PreprocessorPyTorch
3736

3837
if TYPE_CHECKING:
3938
import torch
39+
from art.utils import CLIP_VALUES_TYPE
4040

4141
logger = logging.getLogger(__name__)
4242

@@ -111,16 +111,21 @@ def __init__(
111111
self,
112112
window_size: int = 3,
113113
channels_first: bool = False,
114-
clip_values: Optional[CLIP_VALUES_TYPE] = None,
114+
clip_values: Optional["CLIP_VALUES_TYPE"] = None,
115115
apply_fit: bool = False,
116116
apply_predict: bool = True,
117117
device_type: str = "gpu",
118118
) -> None:
119119
"""
120120
Create an instance of local spatial smoothing.
121121
122+
:window_size: Size of spatial smoothing window.
123+
:param channels_first: Set channels first or last.
124+
:param clip_values: Tuple of the form `(min, max)` representing the minimum and maximum values allowed
125+
for features.
126+
:param apply_fit: True if applied during fitting/training.
127+
:param apply_predict: True if applied during predicting.
122128
:param device_type: Type of device on which the classifier is run, either `gpu` or `cpu`.
123-
:param **kwargs: Parameters from the parent.
124129
"""
125130
import torch # lgtm [py/repeated-import]
126131

art/defences/preprocessor/spatial_smoothing_tensorflow.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@
3333
import numpy as np
3434

3535
from art.utils import ART_NUMPY_DTYPE
36-
from art.utils import CLIP_VALUES_TYPE
3736
from art.defences.preprocessor.preprocessor import PreprocessorTensorFlowV2
3837

3938
if TYPE_CHECKING:
4039
import tensorflow as tf
40+
from art.utils import CLIP_VALUES_TYPE
4141

4242
logger = logging.getLogger(__name__)
4343

@@ -57,14 +57,19 @@ def __init__(
5757
self,
5858
window_size: int = 3,
5959
channels_first: bool = False,
60-
clip_values: Optional[CLIP_VALUES_TYPE] = None,
60+
clip_values: Optional["CLIP_VALUES_TYPE"] = None,
6161
apply_fit: bool = False,
6262
apply_predict: bool = True,
6363
) -> None:
6464
"""
6565
Create an instance of local spatial smoothing.
6666
67-
:param **kwargs: Parameters from the parent.
67+
:window_size: Size of spatial smoothing window.
68+
:param channels_first: Set channels first or last.
69+
:param clip_values: Tuple of the form `(min, max)` representing the minimum and maximum values allowed
70+
for features.
71+
:param apply_fit: True if applied during fitting/training.
72+
:param apply_predict: True if applied during predicting.
6873
"""
6974
super().__init__()
7075

docs/index.rst

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,28 @@
66
Welcome to the Adversarial Robustness Toolbox
77
=============================================
88

9+
.. image:: ./images/art_lfai.png
10+
:width: 400
11+
:alt: ART Logo
12+
:align: center
13+
914
Adversarial Robustness Toolbox (ART) is a Python library for Machine Learning Security. ART provides tools that enable
1015
developers and researchers to evaluate, defend, certify and verify Machine Learning models and applications against
1116
the adversarial threats of Evasion, Poisoning, Extraction, and Inference. ART supports all popular machine learning
1217
frameworks (TensorFlow, Keras, PyTorch, MXNet, scikit-learn, XGBoost, LightGBM, CatBoost, GPy, etc.), all data types
1318
(images, tables, audio, video, etc.) and machine learning tasks (classification, object detection, generation,
1419
certification, etc.).
1520

21+
.. image:: ./images/adversarial_threats_attacker.png
22+
:width: 400
23+
:alt: ART Logo
24+
:align: center
25+
26+
.. image:: ./images/adversarial_threats_art.png
27+
:width: 400
28+
:alt: ART Logo
29+
:align: center
30+
1631
The code of ART is on `GitHub`_ and the Wiki contains overviews of implemented `attacks`_, `defences`_ and `metrics`_.
1732

1833
The library is under continuous development. Feedback, bug reports and contributions are very welcome!
@@ -45,7 +60,9 @@ Supported Machine Learning Libraries
4560
modules/attacks
4661
modules/attacks/evasion
4762
modules/attacks/extraction
48-
modules/attacks/inference
63+
modules/attacks/inference/attribute_inference
64+
modules/attacks/inference/membership_inference
65+
modules/attacks/inference/model_inversion
4966
modules/attacks/poisoning
5067
modules/defences
5168
modules/defences/detector_evasion

docs/modules/attacks/evasion.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,18 @@ Shadow Attack
164164
:members:
165165
:special-members:
166166

167+
ShapeShifter Attack
168+
-------------------
169+
.. autoclass:: ShapeShifter
170+
:members:
171+
:special-members:
172+
173+
SimBA Attack
174+
------------
175+
.. autoclass:: SimBA
176+
:members:
177+
:special-members:
178+
167179
Spatial Transformations Attack
168180
------------------------------
169181
.. autoclass:: SpatialTransformation
@@ -176,6 +188,12 @@ Square Attack
176188
:members:
177189
:special-members:
178190

191+
Targeted Universal Perturbation Attack
192+
--------------------------------------
193+
.. autoclass:: TargetedUniversalPerturbation
194+
:members:
195+
:special-members:
196+
179197
Universal Perturbation Attack
180198
-----------------------------
181199
.. autoclass:: UniversalPerturbation

docs/modules/attacks/inference.rst renamed to docs/modules/attacks/inference/attribute_inference.rst

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
:mod:`art.attacks.inference`
2-
============================
3-
.. automodule:: art.attacks.inference
1+
:mod:`art.attacks.inference.attribute_inference`
2+
================================================
3+
.. automodule:: art.attacks.inference.attribute_inference
44

55
Attribute Inference Black-Box
66
-----------------------------
@@ -19,9 +19,3 @@ Attribute Inference White-Box Decision-Tree
1919
.. autoclass:: AttributeInferenceWhiteBoxDecisionTree
2020
:members:
2121
:special-members:
22-
23-
MIFace
24-
------
25-
.. autoclass:: MIFace
26-
:members:
27-
:special-members:
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
:mod:`art.attacks.inference.membership_inference`
2+
=================================================
3+
.. automodule:: art.attacks.inference.membership_inference
4+
5+
Membership Inference Black-Box
6+
------------------------------
7+
.. autoclass:: MembershipInferenceBlackBox
8+
:members:
9+
:special-members:
10+
11+
Membership Inference Black-Box Rule-Based
12+
-----------------------------------------
13+
.. autoclass:: MembershipInferenceBlackBoxRuleBased
14+
:members:
15+
:special-members:
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
:mod:`art.attacks.inference.model_inversion`
2+
============================================
3+
.. automodule:: art.attacks.inference.model_inversion
4+
5+
Model Inversion MIFace
6+
----------------------
7+
.. autoclass:: MIFace
8+
:members:
9+
:special-members:

0 commit comments

Comments
 (0)