-
|
Hello, I am doing PINNs in my bachelor's thesis and to start, I got assigned to try to use them to solve Poisson's problem in 1D with Dirichlet boundary condition. I tried it with keras (high level API for tensorflow), but my neural network wasn't really approximating the real solution. In some paper I saw DeepXDE mentioned so I gave it a try according to the demo https://deepxde.readthedocs.io/en/latest/demos/pinn_forward/poisson.1d.dirichlet.html. And I have to say I am amazed, the same problem with the same set up (same network architecture, optimizer and number of epochs) was solved by your DeepXDE much faster and nearly perfectly. So concerning the precision, could you, please, tell me, what loss functions are optimized and used during the training in the network from the DeepXDE demo? I tried digging in the source code to see if I could find it, but was unsuccessful. Here below I write how I did the training in my own code using keras. It might not be needed to answer the question above, but I provided it just in case. In short what I do is I compute the second derivative of the output with respect to the input for each point inside the interval and for both boundary points. For the points inside the interval I then compute the residual, square it and then take the mean over all points inside the interval. Note: I took the equation as du/dx^2 = F instead of -du/dx^2 = F, therefore the residual is computed as +du/dx^2 - F, instead of In my deepXDE code I used the same code as in the demo, except I didn't include If you wouldn't mind tellling me, please, I am interested in which loss functions uses DeepXDE for the 1D Poisson problem in the demo, as your DeepXDE gives a very accurate solution. Or if you would possible have any other idea, why my simple implementation doesn't give accurate result (below I included a picture with the accuracy of my network). |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Ok I found out that my accuracy was off because I wasn't actually putting the correct equation into my code (I was using a different equation before I switched to the one from deepxde tutorial, but I accidentally forgot to change it in my NN setup). And the slower speed was because I was using more points with smaller batch size (therefore much more training iterations took place) + I was using keras, which has a nice progress bar displayed each epoch in terminal, but writing it to the terminal also took quite a bit of time. After I turned off the progress bar and set my number of points also to 18, I was getting similar training speeds as deepxde. |
Beta Was this translation helpful? Give feedback.

Ok I found out that my accuracy was off because I wasn't actually putting the correct equation into my code (I was using a different equation before I switched to the one from deepxde tutorial, but I accidentally forgot to change it in my NN setup). And the slower speed was because I was using more points with smaller batch size (therefore much more training iterations took place) + I was using keras, which has a nice progress bar displayed each epoch in terminal, but writing it to the terminal also took quite a bit of time. After I turned off the progress bar and set my number of points also to 18, I was getting similar training speeds as deepxde.