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

Custom losses (e.g. H^1-norm) #467

Closed
pescap opened this issue Dec 30, 2021 · 1 comment
Closed

Custom losses (e.g. H^1-norm) #467

pescap opened this issue Dec 30, 2021 · 1 comment

Comments

@pescap
Copy link
Contributor

pescap commented Dec 30, 2021

Hi,
I was trying to reproduce the method proposed in: Gradient-enhanced physics-informed neural networks for forward and inverse PDE problems, for example using H^1 (Sobolev) norm instead of a L^2 norm.

Generally, the losses take (y_true, y_pred) as inputs.

Is there a simple way to incorporate x to the losses in order to evaluate gradient based losses/norms?

In parallel, it could be interesting to enable "custom losses" for model.compile(), i.e. something like
model.compile(loss_fn = custom_loss)
with a previously defined custom_loss(y_true, y_pred) or even custom_loss(y_true, y_pred, x)

Thank you for your help!
Paul

@lululxvi
Copy link
Owner

The code of gPINN will be public soon.

DeepXDE already supports it:

def custom_loss(y_true, y_pred):
    ...

model.compile(loss=custom_loss)

But not custom_loss(y_true, y_pred, x).

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