Commit graph

539 commits

Author SHA1 Message Date
A. Unique TensorFlower
9ed34da715 Integrate the fast gradient clipping algorithm with the DP Keras Model class.
PiperOrigin-RevId: 504931452
2023-01-26 13:45:56 -08:00
A. Unique TensorFlower
bc84ed7bfb Add fast gradient clipping tests.
PiperOrigin-RevId: 504923799
2023-01-26 13:16:19 -08:00
A. Unique TensorFlower
a3b14ae20a First implementation of the fast gradient clipping algorithm.
PiperOrigin-RevId: 504668189
2023-01-25 14:51:09 -08:00
Steve Chien
ee3d349a8d Fix copybara removal of tkinter library.
PiperOrigin-RevId: 504656239
2023-01-25 14:06:27 -08:00
Yilei Yang
622282e034 Update dependency on tkinter.
PiperOrigin-RevId: 503401013
2023-01-20 03:24:46 -08:00
Peter Hawkins
3d038a490a [NumPy] Remove references to deprecated NumPy type aliases.
This change replaces references to a number of deprecated NumPy type aliases (np.bool, np.int, np.float, np.complex, np.object, np.str) with their recommended replacement (bool, int, float, complex, object, str).

NumPy 1.24 drops the deprecated aliases, so we must remove uses before updating NumPy.

PiperOrigin-RevId: 497194550
2022-12-22 10:32:59 -08:00
Steve Chien
f99a74c7a4 Fix dependencies required by privacy_tests.
Update `distutils` to `packaging`.

PiperOrigin-RevId: 496713867
2022-12-20 11:49:28 -08:00
Shuang Song
2040f08f0d Allows slicing by custom indices.
PiperOrigin-RevId: 486998645
2022-11-08 11:05:26 -08:00
A. Unique TensorFlower
ec747a8d75 Correct imports of keras loss utils
PiperOrigin-RevId: 486795765
2022-11-07 16:34:00 -08:00
A. Unique TensorFlower
e334633466 Bugfix.
PiperOrigin-RevId: 486344068
2022-11-05 05:18:58 -07:00
Shuang Song
f7e1e61823 Adds a utility function for formating list into string.
PiperOrigin-RevId: 484026229
2022-10-26 11:33:30 -07:00
Shuang Song
7d7b670f5d Add functions to derive epsilon lower bounds.
PiperOrigin-RevId: 484021227
2022-10-26 11:15:47 -07:00
A. Unique TensorFlower
3f16540bfc Efficient DP optimizers for sparse models.
PiperOrigin-RevId: 482871514
2022-10-21 13:15:52 -07:00
Galen Andrew
a7d929a21c Bump version for release.
PiperOrigin-RevId: 482286678
2022-10-19 13:21:35 -07:00
Steve Chien
0fcfd0bf69 Remove pfor dependency in BUILD file, and strengthen unit tests for clip_and_aggregate_gradients.py.
PiperOrigin-RevId: 482050282
2022-10-18 16:21:37 -07:00
Steve Chien
4aa531faa4 Remove dependence on six in clip_and_aggregate_gradients.py.
PiperOrigin-RevId: 481750014
2022-10-17 15:07:27 -07:00
A. Unique TensorFlower
d5538fccbb Ensures DPOptimizer objects can be serialized by TensorFlow.
Handles by processing tensors to numpy. Adds tests to now capture this.

PiperOrigin-RevId: 481656298
2022-10-17 09:12:10 -07:00
A. Unique TensorFlower
c25cb4a41b Clip (per-example) and aggregate gradients.
PiperOrigin-RevId: 480761907
2022-10-12 17:43:21 -07:00
A. Unique TensorFlower
71837fbeec Adds DP-FTRL via tree aggregation optimizer DPFTRLTreeAggregationOptimizer.
Includes renaming of `frequency` parameter in restart_query.py to `period` to more more accurately reflect its purpose.

PiperOrigin-RevId: 480736961
2022-10-12 15:47:07 -07:00
A. Unique TensorFlower
5e37c1bc70 Implement initial_sample_state for TreeRangeSumQuery.
PiperOrigin-RevId: 480685277
2022-10-12 12:11:21 -07:00
A. Unique TensorFlower
79fe32a60b Changes DPOptimizerClass to generically accept and use any dp_sum_query.
This enables creation of generic DPOptimizers by user's passing queries. The most common Gaussian query is automatically performed for convenience and backwards compatibility.

Byproducts of this update:
-ensures consistent implementations between the internal (and legacy) `get_gradients` and newer `_compute_gradients` for all queries.
-refactors for python readability.
-includes new tests ensuring that `_num_microbatches=None` is tested.
-changes the `_global_state` to to be initialized in the init function for `_compute_gradients`.

PiperOrigin-RevId: 480668376
2022-10-12 11:03:55 -07:00
A. Unique TensorFlower
f8ed0fcd9c Fix SumAggregationDPQuery's initial_sample_state raising a ValueError when called on TensorSpec.
PiperOrigin-RevId: 480474975
2022-10-11 16:02:00 -07:00
A. Unique TensorFlower
0738d6f555 Bugfix.
PiperOrigin-RevId: 478591776
2022-10-03 13:33:33 -07:00
A. Unique TensorFlower
3f6d0acdef Add ability to use sample weights to the membership attack models, where they are supported by the underlying Scikit-Learn estimators. Only the Logistic Regression and Random Forest estimators support sample weights.
PiperOrigin-RevId: 478542133
2022-10-03 10:32:31 -07:00
Chen Qian
c6c3334b57 Code changes to get ready for an incoming Keras optimizer migration.
DP optimizer only supports legacy optimizer.

PiperOrigin-RevId: 474137890
2022-09-13 15:20:26 -07:00
Shuang Song
08364adcb7 Allow squared loss to take in labels and predictions of the same number of elements but different shapes.
PiperOrigin-RevId: 474059427
2022-09-13 10:32:58 -07:00
Yilei Yang
ebae6c086e Make this code compatible with Python 3.10.
PiperOrigin-RevId: 473313795
2022-09-09 12:20:05 -07:00
Chen Qian
715fd1a670 Code changes to get ready for an incoming Keras optimizer migration.
Because the code subclasses the legacy Keras optimizer, we should explicitly use the legacy optimizer.

PiperOrigin-RevId: 473092233
2022-09-08 14:56:56 -07:00
Steve Chien
407e5c8e11 Clarify logic in Keras version of DP-SGD optimizer, and add a unit test involving clipping on multiple variables.
PiperOrigin-RevId: 472559697
2022-09-06 14:36:43 -07:00
Steve Chien
ed73077b60 Change version to 0.8.5. (Previously incorrectly skipped ahead to 0.8.6)
PiperOrigin-RevId: 471118348
2022-08-30 16:28:14 -07:00
Steve Chien
875b7f46bd Automated rollback of commit cff47686f6
PiperOrigin-RevId: 471104040
2022-08-30 15:23:08 -07:00
A. Unique TensorFlower
cff47686f6 Changes DPOptimizerClass to generically accept and use any dp_sum_query.
This enables creation of generic DPOptimizers by user's passing queries. The most common Gaussian query is automatically performed for convenience and backwards compatibility.

Byproducts of this update:
-ensures consistent implementations between the internal (and legacy) `get_gradients` and newer `_compute_gradients` for all queries.
-refactors for python readability.

PiperOrigin-RevId: 470883774
2022-08-29 20:22:40 -07:00
Steve Chien
ed16033a92 Update pinned commit of dp-accounting library, update dependency versions, and increase version to 0.8.6.
PiperOrigin-RevId: 470334560
2022-08-26 14:30:16 -07:00
Shuang Song
9f4feade7d Add more documentation for gradient_accumulation_steps in keras optimizer.
PiperOrigin-RevId: 469310667
2022-08-22 16:16:46 -07:00
Steve Chien
9e25eee68b Update remaining DPQuery tests to TF2.
PiperOrigin-RevId: 468793518
2022-08-19 15:08:15 -07:00
Steve Chien
fd64be5b5b Update several DPQuery tests to TF v2.
PiperOrigin-RevId: 468763153
2022-08-19 12:40:49 -07:00
Steve Chien
d6ad59226d Update tests for optimizer classes to TF 2.
PiperOrigin-RevId: 468587323
2022-08-18 17:38:01 -07:00
Steve Chien
5dd11fcdd6 Add import of log_loss in keras_evaluation.py.
PiperOrigin-RevId: 468294581
2022-08-17 14:31:20 -07:00
Michael Reneer
052f9a3128 Update the version of numpy to 1.23.2.
* Updated the numpy version.
* Synced the pandas version.

In Python 3.10, if you invoke `pip install pandas~=1.1.4 numpy~=1.21.4` and then `import pandas` you get the following error:

```
>>> import pandas
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/tmp/venv/lib/python3.10/site-packages/pandas/__init__.py", line 30, in <module>
    from pandas._libs import hashtable as _hashtable, lib as _lib, tslib as _tslib
  File "/tmp/venv/lib/python3.10/site-packages/pandas/_libs/__init__.py", line 13, in <module>
    from pandas._libs.interval import Interval
  File "pandas/_libs/interval.pyx", line 1, in init pandas._libs.interval
ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject
```

I believe that this is the cause of the issue https://github.com/scikit-learn-contrib/hdbscan/issues/457#issuecomment-773671043

PiperOrigin-RevId: 467952859
2022-08-16 10:02:07 -07:00
Shuang Song
40d73ed240 Add logging for secret sharer exposure computation.
PiperOrigin-RevId: 467771239
2022-08-15 15:06:42 -07:00
Galen Andrew
8a449aaa27 Correct discrepancy between tensorflow-probability versions in requirements.txt vs setup.py.
PiperOrigin-RevId: 467326193
2022-08-12 17:04:55 -07:00
Galen Andrew
5a9866726d Change requirements for tensorflow-probability and pandas.
PiperOrigin-RevId: 467220343
2022-08-12 08:58:14 -07:00
Galen Andrew
ca077a5b12 Use calibrate_dp_mechanism from differential_privacy library instead of custom binary search.
PiperOrigin-RevId: 466798182
2022-08-10 15:19:44 -07:00
Shuang Song
a9abfbc244 Allow specifying loss function with string.
PiperOrigin-RevId: 465333272
2022-08-04 09:31:28 -07:00
Steve Chien
a8a5206841 Update TFP to version 0.8.2.
PiperOrigin-RevId: 463664333
2022-07-27 13:29:15 -07:00
Steve Chien
848cfc74c1 Add logistic regression functions to API.
PiperOrigin-RevId: 463645193
2022-07-27 12:05:06 -07:00
Shuang Song
17cd0c52bc Refactor: move loss computation utilities under privacy_tests.
PiperOrigin-RevId: 463391913
2022-07-26 11:49:40 -07:00
Michael Reneer
d16f020329 Fix usage of logging API.
PiperOrigin-RevId: 463123944
2022-07-25 10:48:31 -07:00
Galen Andrew
4cb0a11c4b Automated rollback of commit db292fc5d8
PiperOrigin-RevId: 462171425
2022-07-20 10:16:48 -07:00
Steve Chien
38fe4aa984 Changes to prepare for release of v0.8.1.
Update WORKSPACE, setup.py, and requirements.txt to latest dp-accounting library release.

Update scipy version in setup.py.

Update version to 0.8.1.

PiperOrigin-RevId: 461944491
2022-07-19 12:22:07 -07:00
A. Unique TensorFlower
2b5d5b6ef5 Add Positive Predictive Value as a metric for membership attack models performance on imbalanced data.
PiperOrigin-RevId: 461390184
2022-07-16 16:30:53 -07:00
Shuang Song
328795aa36 Add assert that the training is private for TF1 vectorized optimizer.
In Keras training in TF 2.0+, compute_gradients() is not called but apply_gradients() is called. W/o calling compute_gradients() dp gradient is not computed, and a normal gradient is used.

PiperOrigin-RevId: 461021412
2022-07-14 12:15:00 -07:00
A. Unique TensorFlower
e826ec717a Switch from a git_repository rule to http_archive for the DP accounting Bazel dependency. This is preferred, per https://docs.bazel.build/versions/main/external.html#repository-rules, to avoid depending on the system git (the HTTP downloader is build into Bazel).
Also use the strip_prefix option to only pull in the accounting WORKSPACE, not the top-level Google DP project WORKSPACE. This allows us to align the import statements to work both when pulling in the `dp_acounting` dependency via Bazel and pip.

PiperOrigin-RevId: 459807060
2022-07-08 12:07:17 -07:00
A. Unique TensorFlower
eaa7354f00 Internal change.
PiperOrigin-RevId: 459620579
2022-07-07 15:48:25 -07:00
Michael Reneer
94beccf10e Automated rollback of commit e32766cc73
PiperOrigin-RevId: 458498524
2022-07-01 10:34:33 -07:00
A. Unique TensorFlower
e32766cc73 Automated rollback of commit b16a0abf1c
PiperOrigin-RevId: 458478847
2022-07-01 08:52:40 -07:00
Michael Reneer
b16a0abf1c Update TFPs dp_accounting dependency.
PiperOrigin-RevId: 458307242
2022-06-30 13:57:42 -07:00
A. Unique TensorFlower
c665281c55 Implementation of Differentially Private Logistic Regression.
PiperOrigin-RevId: 458266079
2022-06-30 11:01:02 -07:00
Galen Andrew
77d962e0fc Use DP library's calibrate_dp_mechanism function to compute noise multiplier.
calibrate_dp_mechanism is in dp_accounting's top level symbols, so after this change we can replace all of the dependencies on DP accounting subpackages with dp_accounting.

Tested by verifying that the resulting noise multiplier is the same before and after change when running all tests in multinomial_logistic_test.

PiperOrigin-RevId: 458235745
2022-06-30 08:47:54 -07:00
Steve Chien
7a5f4eddb8 Internal change.
PiperOrigin-RevId: 455173202
2022-06-15 11:05:05 -07:00
Galen Andrew
db292fc5d8 Automated rollback of commit bb1b7a6a46
PiperOrigin-RevId: 454995196
2022-06-14 17:27:35 -07:00
Galen Andrew
bb1b7a6a46 Remove deprecated rdp_accountant. Please use RdpAccountant from the differential_privacy library.
PiperOrigin-RevId: 454964256
2022-06-14 15:02:34 -07:00
Galen Andrew
c4fea75675 Remove differential_privacy dp_event classes from TFP top-level symbols.
PiperOrigin-RevId: 454238513
2022-06-10 14:09:46 -07:00
Galen Andrew
125f82707a Migrate dependency of tree_aggregation_accountant_test on rdp_accountant to differential_privacy.
PiperOrigin-RevId: 453989532
2022-06-09 12:44:20 -07:00
Matthew Jagielski
6c0cc858e0 Add word2vec attack example to attack library.
PiperOrigin-RevId: 453489150
2022-06-07 11:46:55 -07:00
A. Unique TensorFlower
7d522e9273 Remove an indentation in a comment.
PiperOrigin-RevId: 451008704
2022-05-25 14:01:16 -07:00
A. Unique TensorFlower
5461f911a6 Bugfixes:
1. Child classes of 'TrainedAttacker' now have a 'backend' parameter, so require an __init__() method.

PiperOrigin-RevId: 451005298
2022-05-25 13:46:30 -07:00
A. Unique TensorFlower
95e527acfb Support models with unconnected layers and gradients when training using a DP vectorized optimizer.
PiperOrigin-RevId: 450659644
2022-05-24 05:36:58 -07:00
Steve Chien
f739f45299 Add .bazelversion file.
PiperOrigin-RevId: 448082134
2022-05-11 14:14:48 -07:00
A. Unique TensorFlower
65eadd3a02 Enable parallel processing in the Scikit-Learn models.
Add support for configuring the parallel processing backend for Scikit-Learn while setting up the attack models.

PiperOrigin-RevId: 446844669
2022-05-05 16:21:15 -07:00
A. Unique TensorFlower
7eea74a6a1 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/privacy/pull/230 from npapernot:hyperparam 8835b9c4072e3e598aa49d605e7643a2c2e65988
PiperOrigin-RevId: 446832781
2022-05-05 15:38:47 -07:00
A. Unique TensorFlower
930c4d13e8 Handle the case when the data comes from a multilabel classification problem but the provided samples happen to have just one positive label per sample.
PiperOrigin-RevId: 445468067
2022-04-29 11:36:47 -07:00
Galen Andrew
81d5880702 Migrate accounting in tutorials to Google DP.
PiperOrigin-RevId: 444993855
2022-04-27 16:09:27 -07:00
Fabien Hertschuh
d47cc695cd Consistently import all estimator symbols via tensorflow_estimator as opposed to using tensorflow.estimator for some symbols.
PiperOrigin-RevId: 443417581
2022-04-21 10:36:59 -07:00
Galen Andrew
868cf54470 Deprecates implementations of RDP accounting from tensorflow_privacy in favor of differential_privacy.
PiperOrigin-RevId: 443177278
2022-04-20 13:25:48 -07:00
A. Unique TensorFlower
ee35642b90 Add multi-label support for Tensorflow Privacy membership attacks.
PiperOrigin-RevId: 443176652
2022-04-20 13:23:26 -07:00
Galen Andrew
e14618fe7c Remove DpEvent from tensorflow_privacy which has been migrated to Google DP libraries.
PiperOrigin-RevId: 441490619
2022-04-13 08:40:52 -07:00
Galen Andrew
34ad9dbedc Automated rollback of commit 7e89dad685
PiperOrigin-RevId: 441245348
2022-04-12 11:34:14 -07:00
A. Unique TensorFlower
7e89dad685 Delete TF Privacy fork of the Google DP accounting API.
PiperOrigin-RevId: 440992901
2022-04-11 14:12:46 -07:00
A. Unique TensorFlower
34f8774dad Migrate more references to dp_event to Google DP libraries.
PiperOrigin-RevId: 440230682
2022-04-07 16:39:38 -07:00
A. Unique TensorFlower
676945d3a6 Migrate references to dp_event to Google DP libraries.
PiperOrigin-RevId: 440204574
2022-04-07 14:42:57 -07:00
Fabien Hertschuh
5493a3baf0 Explicitly import estimator from tensorflow as a separate import instead of
accessing it via tf.estimator and depend on the tensorflow estimator target.

PiperOrigin-RevId: 438419860
2022-03-30 16:05:01 -07:00
Fabien Hertschuh
fc2c15ab21 Explicitly import estimator from tensorflow as a separate import instead of
accessing it via tf.estimator and depend on the tensorflow estimator target.

PiperOrigin-RevId: 437818180
2022-03-28 12:00:58 -07:00
Steve Chien
70ab071e23 In dp_optimizer_keras.py, set the default value of unconnected gradients to be 'zero'.
PiperOrigin-RevId: 435759367
2022-03-18 16:10:24 -07:00
A. Unique TensorFlower
d21e492be6 [Py Accounting] Add typing annotations in RDP accounting.
PiperOrigin-RevId: 435703861
2022-03-18 12:20:03 -07:00
A. Unique TensorFlower
adde2064dd Remove dependence on six and use super() in rdp_privacy_accountant
PiperOrigin-RevId: 434668652
2022-03-14 23:24:33 -07:00
A. Unique TensorFlower
42df23eb79 Add Laplace DpEvent
PiperOrigin-RevId: 432475405
2022-03-04 10:14:36 -08:00
Shuang Song
2c65cc7910 In binary log loss for membership inference attack, allow prediction to have shape (n, 1).
PiperOrigin-RevId: 432267275
2022-03-03 13:17:49 -08:00
Shuang Song
767788e9cf Adds per-example membership scores to trained attackers.
PiperOrigin-RevId: 431615160
2022-02-28 23:52:21 -08:00
Steve Chien
a33afde0c1 Add ability to specify number of microbatches in DPModel class.
PiperOrigin-RevId: 430358084
2022-02-22 20:32:05 -08:00
Steve Chien
bfdcb7f64f Update version number to 0.8.0.
PiperOrigin-RevId: 430268000
2022-02-22 12:19:05 -08:00
Shuang Song
ec7d44237c Allow customized loss functions for membership inference attack.
PiperOrigin-RevId: 430267951
2022-02-22 12:17:56 -08:00
Peter Kairouz
39fa1d361f Add DistributedSkellamSumQuery symbol to public API.
PiperOrigin-RevId: 430261878
2022-02-22 11:52:54 -08:00
Shuang Song
12541c23d4 Fix MIA readme: labels are not needed in basic usage.
PiperOrigin-RevId: 430230630
2022-02-22 09:37:42 -08:00
Shuang Song
7d5a57f0a8 An example for running secret sharer on image classification model.
PiperOrigin-RevId: 430083697
2022-02-21 14:04:51 -08:00
Shuang Song
04dd758c8a In secret generation for secret sharer, use np.random.RandomState. Restructure generate_secrets.
PiperOrigin-RevId: 430082580
2022-02-21 13:54:09 -08:00
Peter Kairouz
89de03e0db Adds DistributedSkellamQuery to public TF Privacy.
PiperOrigin-RevId: 429664212
2022-02-18 15:48:20 -08:00
Michael Reneer
69d84d1892 Add TensorFlow Privacy BUILD and WORKSPACE files.
PiperOrigin-RevId: 429141704
2022-02-16 23:30:06 +00:00
Shuang Song
11b4c318a2 Add links to secret sharer colab.
PiperOrigin-RevId: 428844473
2022-02-16 23:27:32 +00:00
Francois Chollet
085b7ddfec Remove deprecated TF1 Layer APIs apply(), get_updates_for(), get_losses_for(), and remove the inputs argument in the add_loss() method.
PiperOrigin-RevId: 428134172
2022-02-11 18:35:49 -08:00
Shuang Song
560926ea22 Functions for advanced MIAs.
PiperOrigin-RevId: 428111799
2022-02-11 16:06:47 -08:00
Francois Chollet
cd38172f35 Remove usage of deprecated layer method.
PiperOrigin-RevId: 427339701
2022-02-08 17:45:45 -08:00
Michael Reneer
bb153c1f9d Internal
PiperOrigin-RevId: 427327078
2022-02-08 16:44:37 -08:00
Michael Reneer
28db674240 Ensure that TF 1.0 API is referenced at the call site in TensorFlow Privacy.
This change makes it easy to search for usage of TF 1.0 API and updates the TF imports across TFP to be written consistently.

PiperOrigin-RevId: 427043028
2022-02-07 16:06:22 -08:00
Shuang Song
ceced43d0b For seq2seq MIA test, call threshold attacker directly.
PiperOrigin-RevId: 426941426
2022-02-07 09:46:03 -08:00
Zheng Xu
2fe51d2eeb Minor fix of tree aggregation accounting docstring.
PiperOrigin-RevId: 426398939
2022-02-04 07:32:22 -08:00
Michael Reneer
c3e7f08fa5 Update to import TF 2.0 in many TensorFlow Privacy Python modules.
PiperOrigin-RevId: 425901093
2022-02-02 09:17:30 -08:00
Michael Reneer
778c804d1b Delete unused TF 1.0 API in TensorFlow Privacy.
PiperOrigin-RevId: 425900761
2022-02-02 09:16:06 -08:00
Zheng Xu
6fde7b0480 Add clearer connection of TFP tree aggregation query and accounting arguments.
PiperOrigin-RevId: 425790945
2022-02-01 21:34:37 -08:00
Michael Reneer
8a6827b27c Update to use TF 2.0 API in TensorFlow Privacy:
tf.logging -> Removed for absl
tf.assert_type -> tf.debugging.assert_type
tf.assert_less_equal -> tf.debugging.assert_less_equal
tf.global_norm -> tf.linalg.global_norm

PiperOrigin-RevId: 425730344
2022-02-01 15:29:09 -08:00
Shuang Song
438da5a09b For secret sharer exposures, allow more dictionary key types, and break ties for the same perplexities. Fix a bug in the test.
PiperOrigin-RevId: 425446829
2022-01-31 13:27:55 -08:00
Michael Reneer
fd242e76b9 Internal
PiperOrigin-RevId: 425430059
2022-01-31 12:17:02 -08:00
Michael Reneer
36b8ea34ef Internal
PiperOrigin-RevId: 424965569
2022-01-28 15:01:34 -08:00
Michael Reneer
25571aaf87 Fix up remaining lint and format in TensorFlow Privacy.
PiperOrigin-RevId: 424948247
2022-01-28 13:44:12 -08:00
Michael Reneer
b37aef1751 Fixed some lint errors in TensorFlow Privacy.
* Fixed `g-backslash-continuation`
* Fixed `g-generic-assert`
* Fixed `g-generic-assert`
* Fixed `raise-missing-from`
* Fixed `unused-argument`

PiperOrigin-RevId: 424931881
2022-01-28 12:31:00 -08:00
Michael Reneer
e6536597c5 Fixed some lint errors in TensorFlow Privacy.
* Fixed `g-importing-member`
* Fixed `g-bad-import-order`

PiperOrigin-RevId: 424926847
2022-01-28 12:10:05 -08:00
Michael Reneer
943ef91ee9 Format TensorFlow Privacy files.
PiperOrigin-RevId: 424923635
2022-01-28 11:57:24 -08:00
Michael Reneer
07230a161a Internal
PiperOrigin-RevId: 424922009
2022-01-28 11:50:35 -08:00
Michael Reneer
7396ad62da Update TensorFlow Privacy to use Python 3 super().
PiperOrigin-RevId: 424916118
2022-01-28 11:26:34 -08:00
Michael Reneer
9050f18b59 Update TensorFlow Privacy to use Python 3 metaclass.
PiperOrigin-RevId: 424773127
2022-01-27 20:32:04 -08:00
Michael Reneer
b0803999ad Add license and missing build targets to __init__.py files in TensorFlow Privacy.
* Added license.
* Removed `.../membership_inference_attack/codelabs/__init__.py`, this code does not look like it needs to be part of the Python package.
* Removed `.../research/pate_2017/__init__.py`, this code does not look like it needs to be part of the Python package.

PiperOrigin-RevId: 424682641
2022-01-27 12:40:23 -08:00
Michael Reneer
c36ce6d799 Normalize mpmath imports in TensorFlow Privacy to be more friendly with strict dependencies and lint.
PiperOrigin-RevId: 424681602
2022-01-27 12:35:43 -08:00
Michael Reneer
81a11eb824 Remove the mock dependency from TensorFlow Privacy, this is now part of the Python standard library.
PiperOrigin-RevId: 424681527
2022-01-27 12:34:59 -08:00
Michael Reneer
a749ce4e30 Remove TensorFlow Privacy __future__ imports.
Note: Exclude changes to the research directory.
PiperOrigin-RevId: 424650953
2022-01-27 10:37:22 -08:00
Michael Reneer
cfb1b881d8 Normalize scipy imports in TensorFlow Privacy to be more friendly with strict dependencies and lint.
PiperOrigin-RevId: 424649853
2022-01-27 10:33:23 -08:00
Michael Reneer
47b439e376 Remove TensorFlow Privacy dependency on six.
Python 2 is not supported, please use Python 3.

PiperOrigin-RevId: 424435761
2022-01-26 13:56:30 -08:00
Michael Reneer
1424cb2418 Rename TensorFlow Privacy Python tests to have the name foo_test.
* Renamed Python test.
* Fixed usage of deprecated `assertRaisesRegexp`.

Python tooling pattern matches on file name, so it is important for tests to end with the suffix "_test" in order to interact with such tooling well.

In this case, these test are getting lint errors they should not and not getting lint errors they should.

PiperOrigin-RevId: 424433864
2022-01-26 13:48:31 -08:00
Michael Reneer
28dbbbb9e5 Remove TensorFlow Privacy Python lint as directive.
This is now the default behavior.

PiperOrigin-RevId: 424403961
2022-01-26 11:47:14 -08:00
Michael Reneer
b309916927 Fix TensorFlow Privacy g-importing-member lint error.
PiperOrigin-RevId: 424356142
2022-01-26 08:40:57 -08:00
Michael Reneer
4b76e882bc Fix lint errors in dp_optimizer_test.
PiperOrigin-RevId: 424183036
2022-01-25 14:36:57 -08:00
Shuang Song
3a4c4400a6 For MIA in seq2seq model, add support for graph mode, add data information and fix small typo in seq2seq_membership_inference_codelab.ipynb.
PiperOrigin-RevId: 422909904
2022-01-19 14:50:48 -08:00
David Marn
f47200f60d Updates the path for seq2seq codelab colab button.
PiperOrigin-RevId: 421607919
2022-01-13 10:53:33 -08:00
Shuang Song
f301595ba5 Fix a bug in keras_evaluation and its example.
PiperOrigin-RevId: 420787967
2022-01-10 09:58:39 -08:00
Galen Andrew
867f3d4c55 Minor bug in tree aggregation accountant test.
PiperOrigin-RevId: 420145652
2022-01-06 14:32:52 -08:00
Galen Andrew
dd1e6f2d0c Automated rollback of commit 668afa892e
PiperOrigin-RevId: 419910568
2022-01-05 14:13:54 -08:00
Galen Andrew
668afa892e Migrate references to dp_event to Google DP libraries.
PiperOrigin-RevId: 419663382
2022-01-04 13:11:10 -08:00
Shuang Song
8d147bc9d7 For MIA plotting, allow customized plotting function and set equal x and y aspects.
PiperOrigin-RevId: 417852309
2021-12-22 11:08:54 -08:00
Steve Chien
c6576f60c4 Ensure that apply_gradients in dp_optimizer.py is using intended arguments for calls to superclass.
PiperOrigin-RevId: 417654563
2021-12-21 11:06:10 -08:00
Steve Chien
347b99d412 Apply fix to apply_gradients method in vectorized DP Keras optimizer that affected gradient aggregation in multi-replica training.
PiperOrigin-RevId: 417506496
2021-12-20 17:10:39 -08:00
A. Unique TensorFlower
31f110698d Fix of the apply_gradients in Keras DP optimizer.
PiperOrigin-RevId: 417503887
2021-12-20 16:52:50 -08:00
David Marn
03014d0e99 Adds an init file to secret sharer.
PiperOrigin-RevId: 416819054
2021-12-16 08:38:46 -08:00
Zheng Xu
38eface1fd zCDP for tree aggregation.
PiperOrigin-RevId: 416338656
2021-12-14 10:33:04 -08:00
Zheng Xu
8850c23f67 Move tree_aggregation accountant to their own module.
PiperOrigin-RevId: 414770173
2021-12-07 10:48:55 -08:00
Zheng Xu
245fd069ca RDP accounting for tree aggregation without restart. This implements the dynamic programming algorithm detailed in the updated version of "Practical and Private (Deep) Learning without Sampling or Shuffling"
https://arxiv.org/abs/2103.00039.

PiperOrigin-RevId: 414583453
2021-12-06 17:38:48 -08:00
A. Unique TensorFlower
49db04e356 Overwrite the get_config method for dp_optimizer to reflect the actual parameters required(noise_multiplier, l2_norm_clip)
PiperOrigin-RevId: 413520270
2021-12-01 15:06:31 -08:00
Wennan Zhu
290ecf7797 Create a hierarchical histogram IterativeProcess that is compatible with tff.backends.mapreduce.MapReduceForm.
PiperOrigin-RevId: 411845363
2021-11-23 10:38:16 -08:00
David Marn
7c4f5bab09 Allows one to run a test on probabilities alone.
PiperOrigin-RevId: 409095932
2021-11-11 02:17:00 -08:00
Zheng Xu
9757e1bc87 Update the tree aggregation RDP accounting for restarts. This prevents the potential inaccurate usage of the previous implementation for no-restarts.
PiperOrigin-RevId: 406878834
2021-11-01 11:39:49 -07:00
A. Unique TensorFlower
c5cb687507 Allow using gradient tape for gradient calculation in graph mode.
PiperOrigin-RevId: 406217961
2021-10-28 14:26:33 -07:00
Steve Chien
c530356ae9 Add tests for varying number of microbatches in dp_optimizer_test.py.
PiperOrigin-RevId: 404072714
2021-10-18 15:09:07 -07:00