Commit graph

804 commits

Author SHA1 Message Date
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
Michael Reneer
feddd28a63 Pin tensorflow-probability to a specific version.
This matches the documentation for specifying version for this project. Additionally, recent version of `tensorflow-probability` are releasing breaking changes and the existing version specifier allows these to breaking changes to be unintentionally pulled in.

PiperOrigin-RevId: 476443999
2022-09-23 13:04:47 -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
Michael Reneer
628e5bb926 Update the setup.py to match the requirements.txt.
PiperOrigin-RevId: 471128177
2022-08-30 17:16:42 -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
Galen Andrew
7fe491f7a4 Update the conventions used to specify the version of a Python dependency.
* For packages that have a stable release, we use a version that is compatible with that release (e.g. `~=x.y`).
* For packages that do not have a stable release, we use a version that matches a release that has been tested (e.g. `==x.y.z`).

Additionally, added documentation to the requirements.txt.

PiperOrigin-RevId: 468720651
2022-08-19 09:38:19 -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
Peter Hawkins
857fe8f482 [NumPy] Replace numpy.asscalar(x) with x.item() in preparation for upgrading NumPy to 1.23.
NumPy 1.23 removes numpy.asscalar() (https://numpy.org/doc/stable/release/1.23.0-notes.html#expired-deprecations), which has been deprecated since NumPy 1.16 (https://numpy.org/doc/stable/release/1.16.0-notes.html#new-deprecations).

x.item() should be identical to the previous implementation of numpy.asscalar(x) in every way.

PiperOrigin-RevId: 466743223
2022-08-10 11:27:07 -07:00
Jake VanderPlas
6718ae2636 Rename jax.experimental.optimizers -> jax.example_libraries.optimizers
Why? The former name has been deprecated since JAX version 0.2.25, released in November 2021 (see https://github.com/google/jax/blob/main/CHANGELOG.md#jax-0225-nov-10-2021), and will soon be removed.

PiperOrigin-RevId: 465670868
2022-08-05 16:24:49 -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
Shuang Song
44dc40454b Minor fix to tutorials.
PiperOrigin-RevId: 463145196
2022-07-25 12:07:46 -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