Esempio n. 1
0
 def test_anonymize_min_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_min(87.0, size=3)
     np.testing.assert_almost_equal(anonymized, expected_values)
Esempio n. 2
0
 def test_anonymize_min_multiple(self):
     expected_values = np.array([87.5864551, 437.701297])
     epsilon = 1.0
     anonymizer = DiffPrivLaplaceMechanism(epsilon)
     self.set_seed()
     anonymized = anonymizer.anonymize_min([87.0, 435.0])
     np.testing.assert_almost_equal(anonymized, expected_values)
Esempio n. 3
0
 def test_anonymize_min_single(self):
     expected_value = 87.58645513850368
     epsilon = 1.0
     anonymizer = DiffPrivLaplaceMechanism(epsilon)
     self.set_seed()
     anonymized = anonymizer.anonymize_min(87.0)
     np.testing.assert_almost_equal(anonymized, expected_value)