lululxvi / deepxde

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

Update scale factor for variable value #1772

Closed bonneted closed 3 months ago

bonneted commented 3 months ago

Sometimes the dynamic for learning the system parameters is not the same as the weight and biases of the NN. This introduces a scale factor to multiply the step calculated by the optimizer to update the variables.

lululxvi commented 3 months ago

It is not only scaling. In many cases, it requires a transformation. Does this code work in JAX? https://github.com/lu-group/sbinn/blob/b2c1c94d6564732189722f6e6772af0f63cb0d8c/sbinn/sbinn_tf.py#L8

bonneted commented 3 months ago

I implemented jax for sbinn, it works fine. This allowed me to spot two bugs for external variables with jax, I opened a new PR to fix them. I've also opened a PR in the sbinn repo for the jax implementation if you're interested.

lululxvi commented 3 months ago

Is this PR necessary? As the user can easily implement a linear transformation.

bonneted commented 3 months ago

Yes you're right, linear transformation works fine. Thank you for letting me know.

For your information, here is the damping effect I was facing because of the too high learning rate : (inverse quantification for linear elasticity) image

Improved with a scale factor of 0.1 : image

Same results doing a linear transformation : image