Esempio n. 1
0
 def test_anonymize_sum_single_many(self):
     expected_values = np.array([145.0590587, 354.4284063, 32.746848])
     lower = 10.0
     upper = 99.0
     epsilon = 1.0
     anonymizer = DiffPrivLaplaceMechanism(epsilon)
     self.set_seed()
     anonymized = anonymizer.anonymize_sum(87.0, lower, upper, size=3)
     np.testing.assert_almost_equal(anonymized, expected_values)
Esempio n. 2
0
 def test_anonymize_sum_multiple(self):
     expected_values = np.array([145.0590587, 702.4284063])
     lower = 10.0
     upper = 99.0
     epsilon = 1.0
     anonymizer = DiffPrivLaplaceMechanism(epsilon)
     self.set_seed()
     anonymized = anonymizer.anonymize_sum([87.0, 435.0], lower, upper)
     np.testing.assert_almost_equal(anonymized, expected_values)
Esempio n. 3
0
 def test_anonymize_sum_single(self):
     expected_value = 145.05905871186388
     lower = 10.0
     upper = 99.0
     epsilon = 1.0
     anonymizer = DiffPrivLaplaceMechanism(epsilon)
     self.set_seed()
     anonymized = anonymizer.anonymize_sum(87.0, lower, upper)
     np.testing.assert_almost_equal(anonymized, expected_value)