-
-
Notifications
You must be signed in to change notification settings - Fork 200
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
KeyError when solving Parameter Identification problem using NeuralPDE.jl #829
Comments
It is working for me: using NeuralPDE, DomainSets
@parameters x,y, λ
@variables u(..)
Dxx = Differential(x)^2
Dyy = Differential(y)^2
frequency_of_wave = 8
eq = Dxx(u(x, y)) + Dyy(u(x, y)) + (frequency_of_wave^2) * λ * u(x,y) ~ 0
bcs = [u(0, y) ~ 0.0, u(1, y) ~ 0.0, u(x, 0) ~ 0.0, u(x, 1) ~ 0.0]
domains = [x ∈ Interval(0.0, 1.0), y ∈ Interval(0.0, 1.0)]
@named pde_system = PDESystem(eq, bcs, domains, [x,y], [u(x,y)], [λ]) output: julia> @named pde_system = PDESystem(eq, bcs, domains, [x,y], [u(x,y)], [λ])
PDESystem
Equations: Equation[Differential(y)(Differential(y)(u(x, y))) + Differential(x)(Differential(x)(u(x, y))) + 64u(x, y)*λ ~ 0]
Boundary Conditions: Equation[u(0, y) ~ 0.0, u(1, y) ~ 0.0, u(x, 0) ~ 0.0, u(x, 1) ~ 0.0]
Domain: Symbolics.VarDomainPairing[Symbolics.VarDomainPairing(x, 0.0 .. 1.0), Symbolics.VarDomainPairing(y, 0.0 .. 1.0)]
Dependent Variables: Num[u(x, y)]
Independent Variables: Num[x, y]
Parameters: Num[λ]
Default Parameter ValuesDict{Any, Any}() Can you post the exact stack trace? |
|
Try giving a default value for lambda: @named pde_system = PDESystem(eq, bcs, domains, [x,y], [u(x,y)], [λ]; defaults = Dict(λ => 1.0)) |
That leads to this error:
|
What line? |
After I changed |
Try: chain = [Lux.Chain(Dense(dim, 3, Lux.σ), Dense(3, 2))] instead of chain = Lux.Chain(Dense(dim, 3, Lux.σ), Dense(3, 2)) BTW, I feel the output dimension should be 1 instead of 2. |
I had some time and was looking into it. This seems to work for me. We can probably do something like returning a default value here (like |
This worked for me. Why does making it an array help? Is it because of the following: chain: a vector of Lux/Flux chains with a d-dimensional input and a 1-dimensional output corresponding to each of the dependent variables (gotten from https://docs.sciml.ai/NeuralPDE/stable/manual/pinns/). Regarding this,
should I do a pull request and change it such that it returns a default? |
Hi, I am getting the following error when trying to solve the inverse problem (learning \lambda) using NeuralPDE.jl: "
KeyError: key λ not found
" and it points towards the line@named pde_system = PDESystem(eq, bcs, domains, [x,y], [u(x,y)], [λ])
.My code is as follows:The text was updated successfully, but these errors were encountered: