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

The trial solutions to additional_loss function are different depending on parameters #855

Open
affans opened this issue May 13, 2024 · 0 comments
Assignees
Labels

Comments

@affans
Copy link

affans commented May 13, 2024

Describe the bug 🐞

The PhysicsInformedNN discretizer has two arguments param_estim and additional_loss for parameter estimation. The additional_loss is a function which accepts three arguments, i.e., additional_loss(phi, θ, p) where θ is a trial solution.

When param_estim = true, the trial solution θ in the additional loss function is a ComponentArray and the dependent variables (suppose x, y z) can be accessed as θ[:x], θ[:y], θ[:z].

When param_estim = false, where we are not interested in parameter estimation but still want the model to fit to additional data, the trial solution θ is still a ComponentArray but the keys are different. That is, the dependent variables are accessed as θ.depvar[:x], θ.depvar[:y], θ.depvar[:z].

Is there a particular reason for why this is?

The docstring also seems incorrect to me. The docs say

additional_loss: a function additional_loss(phi, θ, p_) where phi are the neural
network trial solutions, θ are the weights of the neural network(s), and p_ are the
hyperparameters of the OptimizationProblem. If param_estim = true, then θ additionally
contains the parameters of the differential equation appended to the end of the vector.

but this is not true. The parameters are not appended to the trial solution but passed in as a third argument p. Do the docs need to be updated here?

Expected behavior

I would expect the trial solution θ to still have the same structure (i.e., access to the dependent variables) regardless of the param_estim argument.

Output of versioninfo()

⌃ [b2108857] Lux v0.5.42
  [961ee093] ModelingToolkit v9.13.0
  [315f7962] NeuralPDE v5.16.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants