KindXiaoming / pykan

Kolmogorov Arnold Networks
MIT License
14.75k stars 1.35k forks source link

PDE Solving Demo? #239

Closed cwoolfo1 closed 2 months ago

cwoolfo1 commented 4 months ago

I've noticed that in the PDE solving demo the ground truth solution for the PDE is used to evaluate the boundary condition loss and is thus used in the training process.

            # boundary loss
            bc_true = sol_fun(x_b)
            bc_pred = model(x_b)
            bc_loss = torch.mean((bc_pred-bc_true)**2)

Doesn't this defeat the entire purpose of using KAN models to solve PDEs? Have you tried training a KAN without giving the model previous knowledge of the ground truth solution?

cwoolfo1 commented 4 months ago

image

By simply commenting out the bc loss contribution to the loss calculation and backward step I was able to get similar activation functions in the trained KAN.

cwoolfo1 commented 4 months ago

Training on just interior points has yielded a similar result for this simple demo. Have you tried implementing other methods for training on the boundary that do not rely on knowing the solution to the PDE?

KindXiaoming commented 4 months ago

Hi, to solve a PDE, we need both the PDE and boundary condition. Very likely I didn't fully get your question, but maybe you'll find this helpful: https://en.wikipedia.org/wiki/Physics-informed_neural_networks where a boundary loss is provided (assuming we know about boundary values).

chaous commented 4 months ago

I've noticed that in the PDE solving demo the ground truth solution for the PDE is used to evaluate the boundary condition loss and is thus used in the training process.

            # boundary loss
            bc_true = sol_fun(x_b)
            bc_pred = model(x_b)
            bc_loss = torch.mean((bc_pred-bc_true)**2)

Doesn't this defeat the entire purpose of using KAN models to solve PDEs? Have you tried training a KAN without giving the model previous knowledge of the ground truth solution?

I was able to solve PDE (navier-stokes) without true solution only with differential equations and boundary conditions https://github.com/KindXiaoming/pykan/blob/master/tutorials/physics_informed_kan.ipynb