示例#1
0
 def test_anonymize_count_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_count(87.0, size=3)
     np.testing.assert_almost_equal(anonymized, expected_values)
示例#2
0
 def test_anonymize_count_multiple(self):
     expected_values = np.array([87.5864551, 437.701297])
     epsilon = 1.0
     anonymizer = DiffPrivLaplaceMechanism(epsilon)
     self.set_seed()
     anonymized = anonymizer.anonymize_count([87.0, 435.0])
     np.testing.assert_almost_equal(anonymized, expected_values)
示例#3
0
 def test_anonymize_count_single(self):
     expected_value = 87.58645513850368
     epsilon = 1.0
     anonymizer = DiffPrivLaplaceMechanism(epsilon)
     self.set_seed()
     anonymized = anonymizer.anonymize_count(87.0)
     np.testing.assert_almost_equal(anonymized, expected_value)