lululxvi / deepxde

A library for scientific machine learning and physics-informed learning
https://deepxde.readthedocs.io
GNU Lesser General Public License v2.1
2.62k stars 737 forks source link

Encode the prior knowldge on the symmetry in NN #631

Open ZPLai opened 2 years ago

ZPLai commented 2 years ago

Dear Lu and comunity PINN try to encode the knowledeg from PDE into NN, so as to enhance the NN learning. However, for lots of problem, we have no explict knowledge on PDE, but just some prior about the symmetry of the solution (for instance, f(-x)=f(x), or f(-x)=-f(x)). How can we encode these symmetry knowledge into NN through DeepXDE? I think the apply_feature_transform and apply_ouput_transform may be a possible approach to realize that. Do you have any advice? Or could you share some example for that? Thanks very much

praksharma commented 2 years ago

Do you mean you don't know the PDE? PINN is primarily used to solve PDE. So why would you use DeepXDE or even PINN to solve such a problem?

Can you please talk specifically? Like the exact problem. Are you talking about function approximation?

ZPLai commented 2 years ago

Do you mean you don't know the PDE? PINN is primarily used to solve PDE. So why would you use DeepXDE or even PINN to solve such a problem?

Can you please talk specifically? Like the exact problem. Are you talking about function approximation?

Yes. I'm talking about function approximation. For more detail, I mean if I prior know the ground-truth function f(x) possess the property of f(-x)=f(x) or f(-x)=-f(x), and how can I encode these knowledge into function training.

And the reason I used deepxde becuase it is a general framework, which is flixbile for user to encode the prior knowledge. And I sometimes want to encode PDE and symmetry in deepxde. And I wonder if anyone have similar experiences, and can share it.

lululxvi commented 2 years ago

It is easy to do.

ZPLai commented 1 year ago

It is easy to do.

  • f(-x)=f(x): use a apply_feature_transform which returns the absolution value of x, i.e., f(x) = NN(|x|).
  • f(-x)=-f(x): It should be f(x) = sign(x) NN(|x|).

    • |x| is implemented by apply_feature_transform
    • sign(x) is implemented by apply_ouput_transform

Thanks for response. That's good idea!