Commit 004dd361 authored by Ilya Mironov's avatar Ilya Mironov
Browse files

pylint complaints fixed.

parent 6ce86cd8
......@@ -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__":
......
......@@ -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)))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment