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

this ewc implementation CODE has theoretical ERROR which prevent ewc to work properly #6

Open
aakutalev opened this issue Mar 13, 2021 · 2 comments

Comments

@aakutalev
Copy link

at line 31 of elastic_weight_consolidation.py it calculates mean of log_likelihoods so grad_log_liklihood will contain mean of gradients of log_likelihoods and then at line 35 it squares this mean of gradients of log_likelihoods.
this is WRONG because diagonal element of Fisher matrix is sum of squared gradients of log_liklihoods but not squared sum of gradients of log_liklihoods.
so for each input the separate gradient of log_likelihood must be calculated, then each gradient must be squared and then mean of these squares must be calculated/

@aakutalev aakutalev changed the title this ewc implementation CODE has ERROR which prevent ewc to work properly this ewc implementation CODE has theoretical ERROR which prevent ewc to work properly Mar 13, 2021
@AkaTsukijm
Copy link

at line 31 of elastic_weight_consolidation.py it calculates mean of log_likelihoods so grad_log_liklihood will contain mean of gradients of log_likelihoods and then at line 35 it squares this mean of gradients of log_likelihoods. this is WRONG because diagonal element of Fisher matrix is sum of squared gradients of log_liklihoods but not squared sum of gradients of log_liklihoods. so for each input the separate gradient of log_likelihood must be calculated, then each gradient must be squared and then mean of these squares must be calculated/

totally agree. But i think the difference between these 2 is minor

@ThomasAtlantis
Copy link

I implemented a version to compute sum of squared gradients. See Here.

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

3 participants