Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
ResNet50_tensorflow
Commits
004dd361
Commit
004dd361
authored
May 07, 2018
by
Ilya Mironov
Browse files
pylint complaints fixed.
parent
6ce86cd8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
10 deletions
+12
-10
research/differential_privacy/privacy_accountant/python/rdp_accountant.py
...ntial_privacy/privacy_accountant/python/rdp_accountant.py
+8
-5
research/differential_privacy/privacy_accountant/python/rdp_accountant_test.py
..._privacy/privacy_accountant/python/rdp_accountant_test.py
+4
-5
No files found.
research/differential_privacy/privacy_accountant/python/rdp_accountant.py
View file @
004dd361
...
...
@@ -37,13 +37,12 @@ from __future__ import absolute_import
from
__future__
import
division
from
__future__
import
print_function
from
absl
import
app
from
absl
import
flags
import
math
import
numpy
as
np
import
sys
from
absl
import
app
from
absl
import
flags
import
numpy
as
np
from
scipy
import
special
FLAGS
=
flags
.
FLAGS
...
...
@@ -373,6 +372,9 @@ def get_privacy_spent(orders, rdp, target_eps=None, target_delta=None):
epsilon. Exactly one of target_eps and target_delta must be None.
Returns:
eps, delta, opt_order.
Raises:
ValueError: If target_eps and target_delta are messed up.
"""
if
target_eps
is
None
and
target_delta
is
None
:
raise
ValueError
(
...
...
@@ -390,7 +392,8 @@ def get_privacy_spent(orders, rdp, target_eps=None, target_delta=None):
return
eps
,
target_delta
,
opt_order
def
main
(
_
):
pass
def
main
(
_
):
pass
if
__name__
==
"__main__"
:
...
...
research/differential_privacy/privacy_accountant/python/rdp_accountant_test.py
View file @
004dd361
...
...
@@ -20,8 +20,8 @@ from __future__ import division
from
__future__
import
print_function
from
absl.testing
import
absltest
import
numpy
as
np
import
mpmath
as
mp
import
numpy
as
np
import
rdp_accountant
...
...
@@ -32,9 +32,8 @@ class TestGaussianMoments(absltest.TestCase):
##############################
def
_pdf_gauss_mp
(
self
,
x
,
sigma
,
mean
):
return
1.
/
mp
.
sqrt
(
2.
*
sigma
**
2
*
mp
.
pi
)
*
mp
.
exp
(
-
(
x
-
mean
)
**
2
/
(
2.
*
sigma
**
2
))
return
1.
/
mp
.
sqrt
(
2.
*
sigma
**
2
*
mp
.
pi
)
*
mp
.
exp
(
-
(
x
-
mean
)
**
2
/
(
2.
*
sigma
**
2
))
def
_integral_inf_mp
(
self
,
fn
):
integral
,
_
=
mp
.
quad
(
...
...
@@ -78,7 +77,7 @@ class TestGaussianMoments(absltest.TestCase):
b_numeric
=
self
.
_integral_inf_mp
(
b_lambda_fn
)
if
verbose
:
z0
,
z1
=
rdp_accountant
.
_compute_zs
(
sigma
,
q
)
_
,
z1
=
rdp_accountant
.
_compute_zs
(
sigma
,
q
)
print
(
"z1 = "
,
z1
)
print
(
"x in the Taylor series = "
,
q
/
(
1
-
q
)
*
np
.
exp
(
(
2
*
z1
-
1
)
/
(
2
*
sigma
**
2
)))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment