Exemplo n.º 1
0
 def test_anonymize_max_single_many(self):
     expected_values = np.array([87.5864551, 89.701297, 86.4519884])
     epsilon = 1.0
     anonymizer = DiffPrivLaplaceMechanism(epsilon)
     self.set_seed()
     anonymized = anonymizer.anonymize_max(87.0, size=3)
     np.testing.assert_almost_equal(anonymized, expected_values)
Exemplo n.º 2
0
 def test_anonymize_max_multiple(self):
     expected_values = np.array([87.5864551, 437.701297])
     epsilon = 1.0
     anonymizer = DiffPrivLaplaceMechanism(epsilon)
     self.set_seed()
     anonymized = anonymizer.anonymize_max([87.0, 435.0])
     np.testing.assert_almost_equal(anonymized, expected_values)
Exemplo n.º 3
0
 def test_anonymize_max_single(self):
     expected_value = 87.58645513850368
     epsilon = 1.0
     anonymizer = DiffPrivLaplaceMechanism(epsilon)
     self.set_seed()
     anonymized = anonymizer.anonymize_max(87.0)
     np.testing.assert_almost_equal(anonymized, expected_value)