# TensorFlow Privacy
This repository contains the source code for TensorFlow Privacy, a Python
library that includes implementations of TensorFlow optimizers for training
machine learning models with differential privacy. The library comes with
tutorials and analysis tools for computing the privacy guarantees provided.
The TensorFlow Privacy library is under continual development, always welcoming
contributions. In particular, we always welcome help towards resolving the
issues currently open.
## Latest Updates
2020-12-21: A new
[vectorized version of the TF 2 optimizer](https://github.com/tensorflow/privacy/blob/master/tensorflow_privacy/privacy/optimizers/dp_optimizer_keras_vectorized.py)
is available, which can deliver much faster performance. We recommend trying it
first, and to fall back to using the original non-vectorized version only if
this fails. We are thankful to the
[authors of this paper](https://arxiv.org/abs/2010.09063) for spurring this
change.
## Setting up TensorFlow Privacy
### Dependencies
This library uses [TensorFlow](https://www.tensorflow.org/) to define machine
learning models. Therefore, installing TensorFlow (>= 1.14) is a pre-requisite.
You can find instructions [here](https://www.tensorflow.org/install/). For
better performance, it is also recommended to install TensorFlow with GPU
support (detailed instructions on how to do this are available in the TensorFlow
installation documentation).
In addition to TensorFlow and its dependencies, other prerequisites are:
* `scipy` >= 0.17
* `mpmath` (for testing)
* `tensorflow_datasets` (for the RNN tutorial `lm_dpsgd_tutorial.py` only)
### Installing TensorFlow Privacy
If you only want to use TensorFlow Privacy as a library, you can simply execute
`pip install tensorflow-privacy`
Otherwise, you can clone this GitHub repository into a directory of your choice:
```
git clone https://github.com/tensorflow/privacy
```
You can then install the local package in "editable" mode in order to add it to
your `PYTHONPATH`:
```
cd privacy
pip install -e .
```
If you'd like to make contributions, we recommend first forking the repository
and then cloning your fork rather than cloning this repository directly.
## Contributing
Contributions are welcomed! Bug fixes and new features can be initiated through
GitHub pull requests. To speed the code review process, we ask that:
* When making code contributions to TensorFlow Privacy, you follow the `PEP8
with two spaces` coding style (the same as the one used by TensorFlow) in
your pull requests. In most cases this can be done by running `autopep8 -i
--indent-size 2 <file>` on the files you have edited.
* You should also check your code with pylint and TensorFlow's pylint
[configuration file](https://raw.githubusercontent.com/tensorflow/tensorflow/master/tensorflow/tools/ci_build/pylintrc)
by running `pylint --rcfile=/path/to/the/tf/rcfile <edited file.py>`.
* When making your first pull request, you
[sign the Google CLA](https://cla.developers.google.com/clas)
* We do not accept pull requests that add git submodules because of
[the problems that arise when maintaining git submodules](https://medium.com/@porteneuve/mastering-git-submodules-34c65e940407)
## Tutorials directory
To help you get started with the functionalities provided by this library, we
provide a detailed walkthrough [here](tutorials/walkthrough/README.md) that
will teach you how to wrap existing optimizers
(e.g., SGD, Adam, ...) into their differentially private counterparts using
TensorFlow (TF) Privacy. You will also learn how to tune the parameters
introduced by differentially private optimization and how to
measure the privacy guarantees provided using analysis tools included in TF
Privacy.
In addition, the
`tutorials/` folder comes with scripts demonstrating how to use the library
features. The list of tutorials is described in the README included in the
tutorials directory.
NOTE: the tutorials are maintained carefully. However, they are not considered
part of the API and they can change at any time without warning. You should not
write 3rd party code that imports the tutorials and expect that the interface
will not break.
## Research directory
This folder contains code to reproduce results from research papers related to
privacy in machine learning. It is not maintained as carefully as the tutorials
directory, but rather intended as a convenient archive.
## TensorFlow 2.x
TensorFlow Privacy now works with TensorFlow 2! You can use the new
Keras-based estimators found in
`privacy/tensorflow_privacy/privacy/optimizers/dp_optimizer_keras.py`.
For this to work with `tf.keras.Model` and `tf.estimator.Estimator`, however,
you need to install TensorFlow 2.4 or later.
## Remarks
The content of this repository supersedes the following existing folder in the
tensorflow/models [repository](https://github.com/tensorflow/models/tree/master/research/differential_privacy)
## Contacts
If you have any questions that cannot be addressed by raising an issue, feel
free to contact:
* Galen Andrew (@galenmandrew)
* Steve Chien (@schien1729)
* Nicolas Papernot (@npapernot)
## Copyright
Copyright 2019 - Google LLC
没有合适的资源?快使用搜索试试~ 我知道了~
tensorflow_privacy-0.8.6.tar.gz
0 下载量 132 浏览量
2024-03-28
23:52:58
上传
评论
收藏 180KB GZ 举报
温馨提示
共145个文件
py:136个
txt:4个
pkg-info:2个
算、文件操作、数据分析和网络编程等。Python社区提供了大量的第三方库,如NumPy、Pandas和Requests,极大地丰富了Python的应用领域,从数据科学到Web开发。Python库的丰富性是Python成为最受欢迎的编程语言之一的关键原因之一。这些库不仅为初学者提供了快速入门的途径,而且为经验丰富的开发者提供了强大的工具,以高效率、高质量地完成复杂任务。例如,Matplotlib和Seaborn库在数据可视化领域内非常受欢迎,它们提供了广泛的工具和技术,可以创建高度定制化的图表和图形,帮助数据科学家和分析师在数据探索和结果展示中更有效地传达信息。
资源推荐
资源详情
资源评论
收起资源包目录
tensorflow_privacy-0.8.6.tar.gz (145个子文件)
setup.cfg 38B
LICENSE 12KB
README.md 5KB
PKG-INFO 153B
PKG-INFO 153B
data_structures.py 43KB
dp_optimizer_keras_test.py 41KB
data_structures_test.py 34KB
dp_optimizer_keras.py 26KB
tree_aggregation_query.py 22KB
tree_aggregation.py 21KB
membership_inference_attack.py 20KB
tree_aggregation_query_test.py 20KB
head.py 20KB
optimizers_test.py 18KB
tree_aggregation_test.py 18KB
membership_inference_attack_test.py 17KB
models_test.py 16KB
tree_aggregation_accountant.py 16KB
dp_optimizer.py 16KB
dp_optimizer_test.py 15KB
losses_test.py 14KB
optimizers.py 14KB
quantile_estimator_query_test.py 12KB
dp_query.py 12KB
utils_test.py 12KB
dataset_slicing_test.py 12KB
advanced_mia_test.py 11KB
advanced_mia.py 11KB
seq2seq_mia.py 11KB
tree_range_query.py 11KB
models.py 11KB
models.py 11KB
quantile_adaptive_clip_sum_query_test.py 11KB
quantile_estimator_query.py 11KB
tf_estimator_evaluation.py 11KB
utils.py 11KB
dp_optimizer_keras_vectorized.py 10KB
seq2seq_mia_test.py 10KB
clip_and_aggregate_gradients.py 10KB
multinomial_logistic.py 10KB
privacy_report_test.py 10KB
losses.py 10KB
advanced_mia_example.py 10KB
dp_keras_model_test.py 9KB
dp_optimizer_vectorized_test.py 9KB
dp_optimizer_vectorized.py 8KB
clip_and_aggregate_gradients_test.py 8KB
discrete_gaussian_utils_test.py 8KB
tree_range_query_test.py 8KB
tree_aggregation_accountant_test.py 8KB
dataset_slicing.py 8KB
restart_query_test.py 8KB
restart_query.py 7KB
distributed_discrete_gaussian_query_test.py 7KB
tf_estimator_evaluation_test.py 7KB
nested_query_test.py 7KB
distributed_skellam_query.py 7KB
quantile_adaptive_clip_sum_query.py 7KB
tf_estimator_evaluation_example.py 6KB
keras_evaluation.py 6KB
multi_label_head.py 6KB
binary_class_head.py 6KB
distributed_skellam_query_test.py 6KB
multi_class_head.py 6KB
dp_keras_model.py 6KB
discrete_gaussian_query_test.py 6KB
generate_secrets.py 6KB
privacy_report.py 6KB
models_test.py 6KB
nested_query.py 6KB
discrete_gaussian_utils.py 5KB
__init__.py 5KB
datasets.py 5KB
tensor_buffer.py 5KB
dp_optimizer_eager_test.py 5KB
distributed_discrete_gaussian_query.py 4KB
keras_evaluation_example.py 4KB
exposures.py 4KB
gaussian_query_test.py 4KB
generate_secrets_test.py 4KB
multinomial_logistic_test.py 4KB
normalized_query.py 4KB
gaussian_query.py 4KB
test_utils.py 3KB
datasets_test.py 3KB
discrete_gaussian_query.py 3KB
no_privacy_query.py 3KB
head_test.py 3KB
multi_label_head_test.py 3KB
keras_evaluation_test.py 3KB
multi_class_head_test.py 3KB
utils_tensorboard.py 3KB
plotting.py 3KB
binary_class_head_test.py 3KB
exposures_test.py 3KB
tensor_buffer_eager_test.py 3KB
compute_dp_sgd_privacy_test.py 3KB
compute_dp_sgd_privacy_lib.py 3KB
single_layer_softmax.py 3KB
共 145 条
- 1
- 2
资源评论
程序员Chino的日记
- 粉丝: 2861
- 资源: 4万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功