Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: Discrete mean differs significantly from continuous mean. #301

Open
Jieun316 opened this issue Feb 22, 2024 · 1 comment
Open

Comments

@Jieun316
Copy link

When I run dp_example/create_fed_heart_disease_dp_results.py, I got this error:
File "/home/dbswldms316/FLamby/flamby/strategies/fed_avg.py", line 103, in __init__ self.models_list = [ File "/home/dbswldms316/FLamby/flamby/strategies/fed_avg.py", line 104, in <listcomp> _Model( File "/home/dbswldms316/FLamby/flamby/strategies/utils.py", line 158, in __init__ ) = privacy_engine.make_private_with_epsilon( File "/home/dbswldms316/anaconda3/lib/python3.9/site-packages/opacus/privacy_engine.py", line 517, in make_private_with_epsilon noise_multiplier=get_noise_multiplier( File "/home/dbswldms316/anaconda3/lib/python3.9/site-packages/opacus/accountants/utils.py", line 70, in get_noise_multiplier eps = accountant.get_epsilon(delta=target_delta, **kwargs) File "/home/dbswldms316/anaconda3/lib/python3.9/site-packages/opacus/accountants/prv.py", line 97, in get_epsilon dprv = self._get_dprv(eps_error=eps_error, delta_error=delta_error) File "/home/dbswldms316/anaconda3/lib/python3.9/site-packages/opacus/accountants/prv.py", line 125, in _get_dprv dprvs = [discretize(tprv, domain) for tprv in tprvs] File "/home/dbswldms316/anaconda3/lib/python3.9/site-packages/opacus/accountants/prv.py", line 125, in <listcomp> dprvs = [discretize(tprv, domain) for tprv in tprvs] File "/home/dbswldms316/anaconda3/lib/python3.9/site-packages/opacus/accountants/analysis/prv/prvs.py", line 173, in discretize raise RuntimeError("Discrete mean differs significantly from continuous mean.") RuntimeError: Discrete mean differs significantly from continuous mean.

I don't know why :(

@jeandut
Copy link
Collaborator

jeandut commented Mar 25, 2024

Hi @Jieun316 !
I don't know why it happened to you now but I ran into this error myself in another project (pytorch/opacus#604) and I think either using a smaller epsilon or a more up to date version of opacus should do the trick.
I'll try to see if I can reproduce the error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants