Comments (4)
With respect to your first question, you should set T = FLAGS.total_rounds
. T is the number of federated rounds, which is captured by FLAGS.total_rounds
.
With respect to your second question, there are a few things you need to be aware of. (1) The sampling probability needs to be small enough for you to get a meaningful epsilon. How many clients do you have per round? If it's around 50, then you should get a reasonable sampling probability. (2) The noise multiplier has to be around 1 for you to get reasonable epsilon. What noise multiplier are you using?
from federated.
r you to get a meaningful epsilon. How many clients do you have per round?
Thanks for your quick reply, I think my sampling probability is small enough (2/100= 0.02). I use 2 clients/100 clients per round. The noise multiplier I play with : 0.1,0.2,0.3, 0.5 (for 0.5 my accuracy result is already bad, so I don't play it more). Could you update your code with calculating epsilon? I think it will be quick? But it will helpful for everyone wants to follow.
from federated.
It seems that you may be calculating the sampling probability wrong. The sampling probability is equal to the number of clients per round divided by the total number of clients in the dataset. If you are choosing 2 clients per round and your dataset has around 3,000 clients, then the sampling probability should be 2/3000. Having said that, applying user-level differential privacy with only 2 clients per round is extremely challenging. This explains why you can't go beyond a noise multiplier of 0.5. Did you try to increase the number of clients per round? Can you try using 50? That should allow you to scale up the noise multiplier to something larger than 0.5 (hopefully closer to 1).
With respect to adding how we compute epsilon, this is a good suggestion. I will discuss it internally. For now though, you can use the following.
from tensorflow_privacy.privacy.analysis.rdp_accountant import compute_rdp
from tensorflow_privacy.privacy.analysis.rdp_accountant import get_privacy_spent
def get_eps(q, noise_multiplier, steps, target_delta, orders):
rdp = compute_rdp(q=q, noise_multiplier=noise_multiplier, steps=steps, orders=orders)
eps, delta, _ = get_privacy_spent(orders, rdp, target_delta=target_delta)
return eps
orders = [2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 14, 16, 20, 24, 28, 32, 64, 256]
number_clients = 3012 # Set this to the number of clients in the dataset you are using
q= FLAGS.clients_per_round / number_clients
noise_multiplier = FLAGS.noise_multiplier
steps = FLAGS.total_rounds
target_delta = 1e-5
eps = get_eps(q, noise_multiplier, steps, target_delta, orders)
from federated.
It seems that you may be calculating the sampling probability wrong. The sampling probability is equal to the number of clients per round divided by the total number of clients in the dataset. If you are choosing 2 clients per round and your dataset has around 3,000 clients, then the sampling probability should be 2/3000. Having said that, applying user-level differential privacy with only 2 clients per round is extremely challenging. This explains why you can't go beyond a noise multiplier of 0.5. Did you try to increase the number of clients per round? Can you try using 50? That should allow you to scale up the noise multiplier to something larger than 0.5 (hopefully closer to 1).
With respect to adding how we compute epsilon, this is a good suggestion. I will discuss it internally. For now though, you can use the following.
from tensorflow_privacy.privacy.analysis.rdp_accountant import compute_rdp from tensorflow_privacy.privacy.analysis.rdp_accountant import get_privacy_spent def get_eps(q, noise_multiplier, steps, target_delta, orders): rdp = compute_rdp(q=q, noise_multiplier=noise_multiplier, steps=steps, orders=orders) eps, delta, _ = get_privacy_spent(orders, rdp, target_delta=target_delta) return eps
z
orders = [2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 14, 16, 20, 24, 28, 32, 64, 256]
number_clients = 3012 # Set this to the number of clients in the dataset you are using
q= FLAGS.clients_per_round / number_clients
noise_multiplier = FLAGS.noise_multiplier
steps = FLAGS.total_rounds
target_delta = 1e-5eps = get_eps(q, noise_multiplier, steps, target_delta, orders)
Thanks for your reply. My dataset includes 3012 images (not 3012 clients) which separated into 100 clients. Therefore my sampling probability is correct with 2/100 (2 clients per round). Anyway, I will check with larger number of clients per round as you mentioned. Thanks for your suggestion.
from federated.
Related Issues (20)
- Question on the Implementation of FedYOGI HOT 1
- some questions when run examples in [federated optimization] module. HOT 2
- Issues of federated-gans HOT 2
- AttributeError while trying to run optimization HOT 1
- [optimization]reproduce the result of paper "ADAPTIVE FEDERATED OPTIMIZATION" HOT 7
- [optimization]Split EMNIST and Stackoverflow Evenly HOT 1
- On Dirichlet Concentration Factor HOT 3
- Clarification the result of paper "ADAPTIVE FEDERATED OPTIMIZATION" HOT 2
- TFF reconstruction for time-series prediction HOT 1
- [distributed_dp] Including package versions into the requirements file HOT 12
- [distributed-dp] running of fl_run: AttributeError: module 'tensorflow_federated.python.program' has no attribute 'TensorBoardReleaseManager' HOT 2
- [differential_privacy] Learning rates used for Adaptive Clipping experiments HOT 6
- Flags not consistent in federated/utils/optimizers/optimizer_utils.py
- [large_cohort] AttributeError: 'LearningAlgorithmState' object has no attribute 'model' HOT 3
- Calling bazel within cache directory fails: experiments/emnist:run_experiments
- [federated/targeted_attack] targeted_attack example documentation is inconsistent
- `optimization/`: `num_validation_examples` batches instead of examples
- [distributed-dp] DSkellam goes weird w/ small num_bits HOT 3
- [Distributed DP] Cannot capture a result of an unsupported type NoneType
- Can you provide a Linux version of jaxlib 0.3.14 for download
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from federated.