Skip to content

Commit 507bbb2

Browse files
authored
Fixing Linux build for 3.10 (#437)
* attempt to fix test * polishing
1 parent 442270a commit 507bbb2

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

tests/algorithms/test_numerical_mechanisms.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import numpy as np
22
import pytest
33
import pydp.algorithms.numerical_mechanisms as num_mech
4-
from scipy.special import erfinv
54

65

76
REL_ERR_TOL = 1e-5
@@ -71,13 +70,14 @@ def test_gaussian_mechanism():
7170
value = gaussian.add_noise(value)
7271
assert type(value) is float
7372
conf_level = 0.5
73+
erf_inv_conf_level = 0.4769362762044699 # =erfinv(0.5)
7474
priv_budg = 0.1
7575
interval = gaussian.noise_confidence_interval(0.5, value)
7676
local_gaussian = num_mech.GaussianMechanism(
7777
priv_budg * epsilon, priv_budg * delta, l2_sensitivity
7878
)
7979
assert type(interval) is num_mech.ConfidenceInterval
80-
bound = erfinv(-conf_level) * local_gaussian.std * (2**0.5)
80+
bound = -erf_inv_conf_level * local_gaussian.std * (2**0.5)
8181
lower_bound, upper_bound = value - bound, value + bound
8282
assert_almost_eq(lower_bound, interval.lower_bound)
8383
assert_almost_eq(upper_bound, interval.upper_bound)

0 commit comments

Comments
 (0)