Browse Source

Fix several issues of python-api

tags/v1.2.1
jin-xiulang 4 years ago
parent
commit
d4a447f518
3 changed files with 9 additions and 9 deletions
  1. +6
    -6
      mindarmour/adv_robustness/evaluations/attack_evaluation.py
  2. +2
    -2
      mindarmour/privacy/diff_privacy/mechanisms/mechanisms.py
  3. +1
    -1
      mindarmour/privacy/evaluation/membership_inference.py

+ 6
- 6
mindarmour/adv_robustness/evaluations/attack_evaluation.py View File

@@ -136,10 +136,10 @@ class AttackEvaluate:
- float, return average l0, l2, or linf distance of all success
adversarial examples, return value includes following cases.

- If return value :math:`>=` 0, average lp distance. The lower,
the more successful the attack is.
- If return value :math:`>=` 0, average lp distance. The lower,
the more successful the attack is.

- If return value is -1, there is no success adversarial examples.
- If return value is -1, there is no success adversarial examples.
"""
idxes = self._success_idxes
success_num = idxes.shape[0]
@@ -164,10 +164,10 @@ class AttackEvaluate:
Returns:
- float, average structural similarity.

- If return value ranges between (0, 1), the higher, the more
successful the attack is.
- If return value ranges between (0, 1), the higher, the more
successful the attack is.

- If return value is -1: there is no success adversarial examples.
- If return value is -1: there is no success adversarial examples.
"""
success_num = self._success_idxes.shape[0]
if success_num == 0:


+ 2
- 2
mindarmour/privacy/diff_privacy/mechanisms/mechanisms.py View File

@@ -183,8 +183,8 @@ class NoiseGaussianRandom(_Mechanisms):
initial_noise_multiplier(float): Ratio of the standard deviation of
Gaussian noise divided by the norm_bound, which will be used to
calculate privacy spent. Default: 1.0.
seed(int): Original random seed, if seed=0 random normal will use secure
random number. IF seed!=0 random normal will generate values using
seed(int): Original random seed, if seed=0, random normal will use secure
random number. If seed!=0, random normal will generate values using
given seed. Default: 0.
decay_policy(str): Mechanisms parameters update policy. Default: None.



+ 1
- 1
mindarmour/privacy/evaluation/membership_inference.py View File

@@ -95,7 +95,7 @@ def _softmax_cross_entropy(logits, labels):
class MembershipInference:
"""
Evaluation proposed by Shokri, Stronati, Song and Shmatikov is a grey-box attack.
The attack requires obtain loss or logits results of training samples.
The attack requires loss or logits results of training samples.

References: `Reza Shokri, Marco Stronati, Congzheng Song, Vitaly Shmatikov.
Membership Inference Attacks against Machine Learning Models. 2017.


Loading…
Cancel
Save