Exemplo n.º 1
0
 def test_two_calls_compute_budgets_raise_exception(self):
     budget_accountant = PLDBudgetAccountant(total_epsilon=1,
                                             total_delta=1e-6)
     budget_accountant.request_budget(mechanism_type=MechanismType.LAPLACE)
     budget_accountant.compute_budgets()
     with self.assertRaises(Exception):
         # Budget can be computed only once.
         budget_accountant.compute_budgets()
Exemplo n.º 2
0
 def test_request_after_compute_raise_exception(self):
     budget_accountant = PLDBudgetAccountant(total_epsilon=1,
                                             total_delta=1e-6)
     budget_accountant.request_budget(mechanism_type=MechanismType.LAPLACE)
     budget_accountant.compute_budgets()
     with self.assertRaises(Exception):
         # Budget can not be requested after it has been already computed.
         budget_accountant.request_budget(
             mechanism_type=MechanismType.LAPLACE)
Exemplo n.º 3
0
 def test_invalid_gaussian_delta(self):
     accountant = PLDBudgetAccountant(total_epsilon=1, total_delta=0)
     with self.assertRaises(AssertionError):
         accountant.request_budget(MechanismType.GAUSSIAN)