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

Docs modifications to use QuadratureTraining instead of GridTraining #729

Merged
merged 143 commits into from
Oct 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
143 commits
Select commit Hold shift + click to select a range
b179412
Docs modifications
Sep 3, 2023
70609cc
Removed last instances of GridTraining in tutorials
Sep 4, 2023
e1996c6
Removed dx and dt
Sep 5, 2023
b41c094
docs build fail cleanup
Sep 6, 2023
98638a5
Docs modifications
Sep 3, 2023
d2bd11a
Removed last instances of GridTraining in tutorials
Sep 4, 2023
136d52f
Removed dx and dt
Sep 5, 2023
aa87003
docs build fail cleanup
Sep 6, 2023
87433bc
tried adding a compat version to project.toml
Sep 27, 2023
60218bc
Merge branch 'docs_update' of github.com:sdesai1287/NeuralPDE.jl into…
Sep 27, 2023
ce0bd7d
Merge branch 'SciML:master' into docs_update
sdesai1287 Oct 2, 2023
7837d10
update Project.toml
Oct 2, 2023
5e20ed1
New PR
AstitvaAggarwal Aug 18, 2023
99c7384
Almost done ig
AstitvaAggarwal Aug 20, 2023
1009bff
ready player 1
AstitvaAggarwal Aug 21, 2023
6420f0d
added docs, minor changes, more tests
AstitvaAggarwal Aug 22, 2023
ffd2514
prev tests did not pass the vibe check
AstitvaAggarwal Aug 23, 2023
1cdd5d5
tests
AstitvaAggarwal Aug 23, 2023
444af19
test should pass
AstitvaAggarwal Aug 23, 2023
3f63ab0
ready player one
AstitvaAggarwal Aug 24, 2023
54dd7ee
reduced iters
AstitvaAggarwal Aug 24, 2023
fab3ced
more changes
AstitvaAggarwal Aug 24, 2023
bf06750
optimizing tests
AstitvaAggarwal Aug 24, 2023
037bffe
yuh
AstitvaAggarwal Aug 24, 2023
5fc60b5
.......
AstitvaAggarwal Aug 25, 2023
c25a0ee
pls work man
AstitvaAggarwal Aug 25, 2023
278beab
|TT|
AstitvaAggarwal Aug 25, 2023
2cabddf
[TT]
AstitvaAggarwal Aug 25, 2023
99a5862
statistics dependancy compatib
AstitvaAggarwal Aug 25, 2023
cae3107
im back
AstitvaAggarwal Aug 25, 2023
ecda132
Flux changes
AstitvaAggarwal Aug 25, 2023
c5ef920
.
AstitvaAggarwal Aug 25, 2023
75505e6
less std for weights
AstitvaAggarwal Aug 26, 2023
b43c531
less std for weights
AstitvaAggarwal Aug 26, 2023
1cd1c64
Cleaner Tests, all pass, handled edge cases
AstitvaAggarwal Aug 29, 2023
1d3553a
minor changes
AstitvaAggarwal Aug 29, 2023
183dca0
Julia versions affect accuracy
AstitvaAggarwal Aug 29, 2023
0ac0714
Added my suggested missing Loss function part, adjusted tests
AstitvaAggarwal Sep 1, 2023
71d9127
minor changes
AstitvaAggarwal Sep 1, 2023
faa0b8f
added example, fixed multi dependant variable case, verfied performan…
AstitvaAggarwal Sep 1, 2023
a56f960
fixed tests
AstitvaAggarwal Sep 2, 2023
346e863
float 64 flux layers
AstitvaAggarwal Sep 3, 2023
5ac7676
Bump actions/checkout from 3 to 4
dependabot[bot] Sep 4, 2023
dfec9e6
now uses diff training strategies,
AstitvaAggarwal Sep 9, 2023
5bb907b
tests
AstitvaAggarwal Sep 10, 2023
f2b57c0
relaxed tests
AstitvaAggarwal Sep 10, 2023
d3f3d87
relaxed tests
AstitvaAggarwal Sep 11, 2023
ba4b624
added docs
AstitvaAggarwal Sep 13, 2023
e755bc6
CompatHelper: bump compat for ComponentArrays to 0.15, (keep existing…
Sep 9, 2023
40faafa
Add BPINNs tutorial to docs pages
xtalax Sep 15, 2023
1813449
CompatHelper: add new compat entry for MonteCarloMeasurements at vers…
Sep 15, 2023
c95323c
CompatHelper: bump compat for SciMLBase to 2, (keep existing compat)
Sep 22, 2023
cd3e8b0
Update Project.toml
ChrisRackauckas Sep 22, 2023
87a1cf8
Remove v1.6 from CI
ChrisRackauckas Oct 1, 2023
09f84ff
Update pipeline.yml
ChrisRackauckas Oct 1, 2023
54f5917
Update Project.toml
ChrisRackauckas Oct 1, 2023
8f3252a
Update Project.toml
ChrisRackauckas Oct 1, 2023
c5f7a1b
update Project.toml
Oct 2, 2023
d3ca8b3
Merge branch 'docs_update' of github.com:sdesai1287/NeuralPDE.jl into…
Oct 2, 2023
b133d83
New PR
AstitvaAggarwal Aug 18, 2023
a626cad
Almost done ig
AstitvaAggarwal Aug 20, 2023
3db9f82
ready player 1
AstitvaAggarwal Aug 21, 2023
5cbc0ec
added docs, minor changes, more tests
AstitvaAggarwal Aug 22, 2023
486b876
prev tests did not pass the vibe check
AstitvaAggarwal Aug 23, 2023
cd6ceab
tests
AstitvaAggarwal Aug 23, 2023
bd20f19
test should pass
AstitvaAggarwal Aug 23, 2023
2b172bf
ready player one
AstitvaAggarwal Aug 24, 2023
947dd0a
reduced iters
AstitvaAggarwal Aug 24, 2023
c26e000
more changes
AstitvaAggarwal Aug 24, 2023
45dd116
optimizing tests
AstitvaAggarwal Aug 24, 2023
9fc1561
yuh
AstitvaAggarwal Aug 24, 2023
70917e2
.......
AstitvaAggarwal Aug 25, 2023
bfa76c4
pls work man
AstitvaAggarwal Aug 25, 2023
8b53efd
|TT|
AstitvaAggarwal Aug 25, 2023
1adf3e8
[TT]
AstitvaAggarwal Aug 25, 2023
64aafa0
statistics dependancy compatib
AstitvaAggarwal Aug 25, 2023
6af3bb0
im back
AstitvaAggarwal Aug 25, 2023
8fc955d
Flux changes
AstitvaAggarwal Aug 25, 2023
b46e478
.
AstitvaAggarwal Aug 25, 2023
98bda3c
less std for weights
AstitvaAggarwal Aug 26, 2023
6db19cb
less std for weights
AstitvaAggarwal Aug 26, 2023
4c0732b
Cleaner Tests, all pass, handled edge cases
AstitvaAggarwal Aug 29, 2023
dc4c02f
minor changes
AstitvaAggarwal Aug 29, 2023
a065b8b
Julia versions affect accuracy
AstitvaAggarwal Aug 29, 2023
1ecf50e
Added my suggested missing Loss function part, adjusted tests
AstitvaAggarwal Sep 1, 2023
1362f18
minor changes
AstitvaAggarwal Sep 1, 2023
e62d6dc
added example, fixed multi dependant variable case, verfied performan…
AstitvaAggarwal Sep 1, 2023
47994c9
fixed tests
AstitvaAggarwal Sep 2, 2023
a93f23b
float 64 flux layers
AstitvaAggarwal Sep 3, 2023
db6f4b4
now uses diff training strategies,
AstitvaAggarwal Sep 9, 2023
ef814f1
tests
AstitvaAggarwal Sep 10, 2023
3cee89d
relaxed tests
AstitvaAggarwal Sep 10, 2023
597f08f
relaxed tests
AstitvaAggarwal Sep 11, 2023
7264aab
added docs
AstitvaAggarwal Sep 13, 2023
6569a4e
CompatHelper: add new compat entry for MonteCarloMeasurements at vers…
Sep 15, 2023
61f1e86
CompatHelper: bump compat for SciMLBase to 2, (keep existing compat)
Sep 22, 2023
cc6e9c1
Docs modifications
Sep 3, 2023
894a4b5
Removed last instances of GridTraining in tutorials
Sep 4, 2023
87aa3e4
update Project.toml
Oct 2, 2023
0a97d60
Merge branch 'docs_update' of github.com:sdesai1287/NeuralPDE.jl into…
Oct 2, 2023
352e3e8
New PR
AstitvaAggarwal Aug 18, 2023
4b4a77c
Almost done ig
AstitvaAggarwal Aug 20, 2023
9f78a3a
ready player 1
AstitvaAggarwal Aug 21, 2023
652f8f4
added docs, minor changes, more tests
AstitvaAggarwal Aug 22, 2023
6bb3df3
prev tests did not pass the vibe check
AstitvaAggarwal Aug 23, 2023
7a8f4b5
tests
AstitvaAggarwal Aug 23, 2023
b46c211
test should pass
AstitvaAggarwal Aug 23, 2023
647aae0
ready player one
AstitvaAggarwal Aug 24, 2023
613228b
reduced iters
AstitvaAggarwal Aug 24, 2023
9329a4b
more changes
AstitvaAggarwal Aug 24, 2023
03be17c
optimizing tests
AstitvaAggarwal Aug 24, 2023
d2ceedd
yuh
AstitvaAggarwal Aug 24, 2023
e05ed86
.......
AstitvaAggarwal Aug 25, 2023
726cdb0
pls work man
AstitvaAggarwal Aug 25, 2023
ffcb277
|TT|
AstitvaAggarwal Aug 25, 2023
c5daa60
[TT]
AstitvaAggarwal Aug 25, 2023
4ba95ad
statistics dependancy compatib
AstitvaAggarwal Aug 25, 2023
464b82c
im back
AstitvaAggarwal Aug 25, 2023
2b5a211
Flux changes
AstitvaAggarwal Aug 25, 2023
186e326
.
AstitvaAggarwal Aug 25, 2023
9a1f9aa
less std for weights
AstitvaAggarwal Aug 26, 2023
f22481d
less std for weights
AstitvaAggarwal Aug 26, 2023
e735c84
Cleaner Tests, all pass, handled edge cases
AstitvaAggarwal Aug 29, 2023
63de20d
minor changes
AstitvaAggarwal Aug 29, 2023
9a94743
Julia versions affect accuracy
AstitvaAggarwal Aug 29, 2023
d4786c7
Added my suggested missing Loss function part, adjusted tests
AstitvaAggarwal Sep 1, 2023
9c38687
minor changes
AstitvaAggarwal Sep 1, 2023
ba58a2a
added example, fixed multi dependant variable case, verfied performan…
AstitvaAggarwal Sep 1, 2023
70c7175
fixed tests
AstitvaAggarwal Sep 2, 2023
345067a
float 64 flux layers
AstitvaAggarwal Sep 3, 2023
ab5700f
now uses diff training strategies,
AstitvaAggarwal Sep 9, 2023
37d5e34
tests
AstitvaAggarwal Sep 10, 2023
da7f26f
relaxed tests
AstitvaAggarwal Sep 10, 2023
324ae46
relaxed tests
AstitvaAggarwal Sep 11, 2023
5ca7d77
added docs
AstitvaAggarwal Sep 13, 2023
7831268
CompatHelper: add new compat entry for MonteCarloMeasurements at vers…
Sep 15, 2023
790ac82
CompatHelper: bump compat for SciMLBase to 2, (keep existing compat)
Sep 22, 2023
e6f588e
Docs modifications
Sep 3, 2023
aa39260
Removed last instances of GridTraining in tutorials
Sep 4, 2023
61a3c6e
update Project.toml
Oct 2, 2023
c9ab921
Merge branch 'docs_update' of github.com:sdesai1287/NeuralPDE.jl into…
Oct 2, 2023
3560a97
Merge branch 'master' into docs_update
ChrisRackauckas Oct 6, 2023
0528d75
Merge branch 'master' into docs_update
ChrisRackauckas Oct 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,4 @@ SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test", "CUDA", "SafeTestsets", "OptimizationOptimisers", "OptimizationOptimJL", "Pkg", "OrdinaryDiffEq", "IntegralsCuba"]
test = ["Test", "CUDA", "SafeTestsets", "OptimizationOptimisers", "OptimizationOptimJL", "Pkg", "OrdinaryDiffEq", "IntegralsCuba"]
8 changes: 3 additions & 5 deletions docs/src/tutorials/constraints.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ Dxx = Differential(x)^2
_σ = 0.5
x_0 = -2.2
x_end = 2.2
# Discretization
dx = 0.01

eq = Dx((α * x - β * x^3) * p(x)) ~ (_σ^2 / 2) * Dxx(p(x))

Expand All @@ -57,15 +55,15 @@ lb = [x_0]
ub = [x_end]
function norm_loss_function(phi, θ, p)
function inner_f(x, θ)
dx * phi(x, θ) .- 1
0.01 * phi(x, θ) .- 1
end
prob = IntegralProblem(inner_f, lb, ub, θ)
norm2 = solve(prob, HCubatureJL(), reltol = 1e-8, abstol = 1e-8, maxiters = 10)
abs(norm2[1])
end

discretization = PhysicsInformedNN(chain,
GridTraining(dx),
QuadratureTraining(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dx is still defined.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as dt from the other file, it seems to be used in other places in this file, thats why I didnt remove it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But none of this file should be using it anymore?

Copy link
Contributor Author

@sdesai1287 sdesai1287 Sep 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I removed the instances of dx but it seems like the program is still creating a grid of some kind (see line 61 and below), maybe only for evaluation. I am assuming I don't want to delete all that stuff?

additional_loss = norm_loss_function)

@named pdesystem = PDESystem(eq, bcs, domains, [x], [p(x)])
Expand Down Expand Up @@ -98,7 +96,7 @@ using Plots
C = 142.88418699042 #fitting param
analytic_sol_func(x) = C * exp((1 / (2 * _σ^2)) * (2 * α * x^2 - β * x^4))

xs = [infimum(d.domain):dx:supremum(d.domain) for d in domains][1]
xs = [infimum(d.domain):0.01:supremum(d.domain) for d in domains][1]
u_real = [analytic_sol_func(x) for x in xs]
u_predict = [first(phi(x, res.u)) for x in xs]

Expand Down
4 changes: 2 additions & 2 deletions docs/src/tutorials/derivative_neural_network.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ input_ = length(domains)
n = 15
chain = [Lux.Chain(Dense(input_, n, Lux.σ), Dense(n, n, Lux.σ), Dense(n, 1)) for _ in 1:7]

grid_strategy = NeuralPDE.GridTraining(0.07)
training_strategy = NeuralPDE.QuadratureTraining()
discretization = NeuralPDE.PhysicsInformedNN(chain,
grid_strategy)
training_strategy)

vars = [u1(t, x), u2(t, x), u3(t, x), Dxu1(t, x), Dtu1(t, x), Dxu2(t, x), Dtu2(t, x)]
@named pdesystem = PDESystem(eqs_, bcs__, domains, [t, x], vars)
Expand Down
2 changes: 1 addition & 1 deletion docs/src/tutorials/gpu.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ chain = Chain(Dense(3, inner, Lux.σ),
Dense(inner, inner, Lux.σ),
Dense(inner, 1))

strategy = GridTraining(0.05)
strategy = QuadratureTraining()
ps = Lux.setup(Random.default_rng(), chain)[1]
ps = ps |> ComponentArray |> gpu .|> Float64
discretization = PhysicsInformedNN(chain,
Expand Down
2 changes: 1 addition & 1 deletion docs/src/tutorials/integro_diff.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ bcs = [i(0.0) ~ 0.0]
domains = [t ∈ Interval(0.0, 2.0)]
chain = Chain(Dense(1, 15, Flux.σ), Dense(15, 1)) |> f64

strategy_ = GridTraining(0.05)
strategy_ = QuadratureTraining()
discretization = PhysicsInformedNN(chain,
strategy_)
@named pde_system = PDESystem(eq, bcs, domains, [t], [i(t)])
Expand Down
7 changes: 2 additions & 5 deletions docs/src/tutorials/low_level.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,9 @@ bcs = [u(0, x) ~ -sin(pi * x),
domains = [t ∈ Interval(0.0, 1.0),
x ∈ Interval(-1.0, 1.0)]

# Discretization
dx = 0.05

# Neural network
chain = Lux.Chain(Dense(2, 16, Lux.σ), Dense(16, 16, Lux.σ), Dense(16, 1))
strategy = NeuralPDE.GridTraining(dx)
strategy = NeuralPDE.QuadratureTraining()

indvars = [t, x]
depvars = [u(t, x)]
Expand Down Expand Up @@ -79,7 +76,7 @@ And some analysis:
```@example low_level
using Plots

ts, xs = [infimum(d.domain):dx:supremum(d.domain) for d in domains]
ts, xs = [infimum(d.domain):0.01:supremum(d.domain) for d in domains]
u_predict_contourf = reshape([first(phi([t, x], res.u)) for t in ts for x in xs],
length(xs), length(ts))
plot(ts, xs, u_predict_contourf, linetype = :contourf, title = "predict")
Expand Down
8 changes: 4 additions & 4 deletions docs/src/tutorials/neural_adapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function loss(cord, θ)
chain2(cord, θ) .- phi(cord, res.u)
end

strategy = NeuralPDE.GridTraining(0.02)
strategy = NeuralPDE.QuadratureTraining()

prob_ = NeuralPDE.neural_adapter(loss, init_params2, pde_system, strategy)
callback = function (p, l)
Expand Down Expand Up @@ -179,7 +179,7 @@ for i in 1:count_decomp
bcs_ = create_bcs(domains_[1].domain, phi_bound)
@named pde_system_ = PDESystem(eq, bcs_, domains_, [x, y], [u(x, y)])
push!(pde_system_map, pde_system_)
strategy = NeuralPDE.GridTraining([0.1 / count_decomp, 0.1])
strategy = NeuralPDE.QuadratureTraining()

discretization = NeuralPDE.PhysicsInformedNN(chains[i], strategy;
init_params = init_params[i])
Expand Down Expand Up @@ -243,10 +243,10 @@ callback = function (p, l)
end

prob_ = NeuralPDE.neural_adapter(losses, init_params2, pde_system_map,
NeuralPDE.GridTraining([0.1 / count_decomp, 0.1]))
NeuralPDE.QuadratureTraining())
res_ = Optimization.solve(prob_, BFGS(); callback = callback, maxiters = 2000)
prob_ = NeuralPDE.neural_adapter(losses, res_.minimizer, pde_system_map,
NeuralPDE.GridTraining([0.05 / count_decomp, 0.05]))
NeuralPDE.QuadratureTraining())
res_ = Optimization.solve(prob_, BFGS(); callback = callback, maxiters = 1000)

phi_ = NeuralPDE.get_phi(chain2)
Expand Down
6 changes: 3 additions & 3 deletions docs/src/tutorials/param_estim.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ u0 = [1.0; 0.0; 0.0]
tspan = (0.0, 1.0)
prob = ODEProblem(lorenz!, u0, tspan)
sol = solve(prob, Tsit5(), dt = 0.1)
ts = [infimum(d.domain):dt:supremum(d.domain) for d in domains][1]
ts = [infimum(d.domain):0.01:supremum(d.domain) for d in domains][1]
function getData(sol)
data = []
us = hcat(sol(ts).u...)
Expand Down Expand Up @@ -113,7 +113,7 @@ Then finally defining and optimizing using the `PhysicsInformedNN` interface.

```@example param_estim
discretization = NeuralPDE.PhysicsInformedNN([chain1, chain2, chain3],
NeuralPDE.GridTraining(dt), param_estim = true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dt is still defined?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to be used in other places in this file, thats why I didnt remove it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, dt is used for evenly spaced time grid for the data

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but it's not required when changing to QuadratureTraining.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it can be removed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok I think I have fixed this one

NeuralPDE.QuadratureTraining(), param_estim = true,
additional_loss = additional_loss)
@named pde_system = PDESystem(eqs, bcs, domains, [t], [x(t), y(t), z(t)], [σ_, ρ, β],
defaults = Dict([p .=> 1.0 for p in [σ_, ρ, β]]))
Expand All @@ -130,7 +130,7 @@ And then finally some analysis by plotting.

```@example param_estim
minimizers = [res.u.depvar[depvars[i]] for i in 1:3]
ts = [infimum(d.domain):(dt / 10):supremum(d.domain) for d in domains][1]
ts = [infimum(d.domain):(0.001):supremum(d.domain) for d in domains][1]
u_predict = [[discretization.phi[i]([t], minimizers[i])[1] for t in ts] for i in 1:3]
plot(sol)
plot!(ts, u_predict, label = ["x(t)" "y(t)" "z(t)"])
Expand Down
7 changes: 3 additions & 4 deletions docs/src/tutorials/pdesystem.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ on the space domain:
x \in [0, 1] \, , \ y \in [0, 1] \, ,
```

with grid discretization `dx = 0.05` using physics-informed neural networks.
Using physics-informed neural networks.

## Copy-Pasteable Code

Expand Down Expand Up @@ -52,7 +52,7 @@ chain = Lux.Chain(Dense(dim, 16, Lux.σ), Dense(16, 16, Lux.σ), Dense(16, 1))

# Discretization
dx = 0.05
discretization = PhysicsInformedNN(chain, GridTraining(dx))
discretization = PhysicsInformedNN(chain, QuadratureTraining())

@named pde_system = PDESystem(eq, bcs, domains, [x, y], [u(x, y)])
prob = discretize(pde_system, discretization)
Expand Down Expand Up @@ -122,9 +122,8 @@ Here, we build PhysicsInformedNN algorithm where `dx` is the step of discretizat
`strategy` stores information for choosing a training strategy.

```@example poisson
# Discretization
dx = 0.05
discretization = PhysicsInformedNN(chain, GridTraining(dx))
discretization = PhysicsInformedNN(chain, QuadratureTraining())
```

As described in the API docs, we now need to define the `PDESystem` and create PINNs
Expand Down
Loading