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

Usage of loss which is not CrossEntropy #14

Open
dedeswim opened this issue May 31, 2020 · 0 comments
Open

Usage of loss which is not CrossEntropy #14

dedeswim opened this issue May 31, 2020 · 0 comments

Comments

@dedeswim
Copy link

Hi,

Thank you very much for this implementation!

I noticed that the only allowed loss is CrossEntropyLoss. As I'd need your module to compute Influence Functions on other kinds of losses, how about adding the possibility to use a different loss, perhaps passed as param in the config dict?

I was thinking about the following changes (to avoid disruptive changes to the API):

def s_test(z_test, t_test, model, z_loader, gpu=-1, damp=0.01, scale=25.0,
recursion_depth=5000):

to

def s_test(z_test, t_test, model, z_loader, gpu=-1, damp=0.01, scale=25.0,
           recursion_depth=5000, loss_fn=compute_loss):

And then change

to

loss = loss_fn(y, t)

With something analogous for:

It would be obviously necessary to propagate the loss_fn params to the functions that call grad_z and s_test.

I'd be glad to create a new branch and open a pull request with this change!

Thanks :)

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

1 participant