-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ENGPROD-29: Amending privacy accounting
* Amend input to compute_epsilon and expand orders for RDP * Amend input and expand orders for RDP - styled * Updating RDP input to remove duplicates * Sorted inputs * Add ValueError, correct function call, change variable name * move constants out into module * Typing for constant * Fix import sort * Changed how num_batches_train is calculated after a .filter() operation on tf dataset object * Refine Typing and correct steps calculation * Added tests for test_compute_dp_sgd_privacy output * assert values in test * assert values in test * Style for test GitOrigin-RevId: 2e6a5b49e85a48cf48d25b44a4dd6f6afc5f9dc3
- Loading branch information
1 parent
160ce91
commit 1e6fd38
Showing
3 changed files
with
78 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from typing import Tuple | ||
|
||
import numpy as np | ||
|
||
from gretel_synthetics.tensorflow.dp_model import compute_dp_sgd_privacy, ORDERS | ||
|
||
|
||
def test_compute_dp_sgd_privacy(): | ||
out = compute_dp_sgd_privacy( | ||
n=2000, | ||
batch_size=128, | ||
noise_multiplier=0.01, | ||
epochs=50, | ||
delta=1 / 2000, | ||
orders=ORDERS, | ||
) | ||
assert np.isclose(out[0], 4060510) | ||
assert out[1] == 1.05 | ||
assert len(out) == 2 | ||
assert isinstance(out, Tuple) |