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

BPINN PDE solver #745

Merged
merged 62 commits into from
Jan 7, 2024
Merged
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
59c14a2
ready player one
AstitvaAggarwal Oct 1, 2023
8d4d4cc
ready player one
AstitvaAggarwal Oct 1, 2023
aba99b4
Merge branch 'Bpinn_pde' of https://github.com/AstitvaAggarwal/Neural…
AstitvaAggarwal Oct 2, 2023
eb2c7ff
skeleton of it all
AstitvaAggarwal Oct 2, 2023
eee560a
minor corrections
AstitvaAggarwal Oct 4, 2023
6960497
minor fixes
AstitvaAggarwal Oct 4, 2023
8c6a46f
Merge branch 'SciML:master' into Bpinn_pde
AstitvaAggarwal Oct 5, 2023
a642c1a
ready player one
AstitvaAggarwal Oct 1, 2023
d533d5f
skeleton of it all
AstitvaAggarwal Oct 2, 2023
8ea0cb3
minor corrections
AstitvaAggarwal Oct 4, 2023
3e7e784
minor fixes
AstitvaAggarwal Oct 4, 2023
9d39deb
Merge branch 'Bpinn_pde' of https://github.com/AstitvaAggarwal/Neural…
AstitvaAggarwal Oct 8, 2023
b5cabb8
works but dosent sample correctly
AstitvaAggarwal Oct 17, 2023
3892b3f
Merge branch 'SciML:master' into Bpinn_pde
AstitvaAggarwal Oct 17, 2023
e7dcfbd
Merge branch 'Bpinn_pde' of https://github.com/AstitvaAggarwal/Neural…
AstitvaAggarwal Oct 17, 2023
5e263eb
works for non adaptive Forward solving
AstitvaAggarwal Oct 24, 2023
4b93047
parameter estimation works for Flux chains
AstitvaAggarwal Nov 3, 2023
805380c
Inverse problem solving now works for Lux chains
AstitvaAggarwal Nov 13, 2023
a2a2292
THE PDE SOLVER WORKS COMPLETELY
AstitvaAggarwal Nov 17, 2023
cf2faa4
testing partially complete, minor changes overall
AstitvaAggarwal Nov 18, 2023
9069028
minor changes
AstitvaAggarwal Nov 18, 2023
98e0a94
include dataset points into physicsloglikelhiood
AstitvaAggarwal Nov 23, 2023
d48b1c8
overlapping points losses added
AstitvaAggarwal Nov 25, 2023
dc3dceb
Added user inference options(stand in for api)
AstitvaAggarwal Nov 30, 2023
f91adc3
Merge branch 'SciML:master' into Bpinn_pde
AstitvaAggarwal Nov 30, 2023
8ca43f9
Added some tests and examples
AstitvaAggarwal Nov 30, 2023
2fa5e97
changes from reviews
AstitvaAggarwal Dec 21, 2023
fe4a8ee
review changes and tests
AstitvaAggarwal Dec 21, 2023
769b3bf
Update src/PDE_BPINN.jl
Vaibhavdixit02 Dec 21, 2023
463fc9d
Minor changes
AstitvaAggarwal Dec 21, 2023
dbf1d06
Merge branch 'Bpinn_pde' of https://github.com/AstitvaAggarwal/Neural…
AstitvaAggarwal Dec 21, 2023
8468821
added tests
AstitvaAggarwal Dec 22, 2023
2d3e17e
minor changes
AstitvaAggarwal Dec 22, 2023
ff09368
added group in CI
AstitvaAggarwal Dec 26, 2023
838a8f2
checks
AstitvaAggarwal Dec 26, 2023
ba4031d
tests-2
AstitvaAggarwal Dec 27, 2023
9678079
tests-3
AstitvaAggarwal Dec 27, 2023
6b4fb0c
Merge branch 'SciML:master' into Bpinn_pde
AstitvaAggarwal Dec 27, 2023
730dbb6
tests-3
AstitvaAggarwal Jan 1, 2024
b986523
forward tests done
AstitvaAggarwal Jan 1, 2024
df22edf
relaxed tests
AstitvaAggarwal Jan 1, 2024
9f4eab9
invsoltests-1
AstitvaAggarwal Jan 3, 2024
c7e4f3d
minor changes
AstitvaAggarwal Jan 3, 2024
feae732
minor changes
AstitvaAggarwal Jan 4, 2024
d7ec1fe
changes from reviews
AstitvaAggarwal Jan 4, 2024
f6c542d
minor changes
AstitvaAggarwal Jan 4, 2024
99d488b
Finished.
AstitvaAggarwal Jan 4, 2024
9db9b18
.
AstitvaAggarwal Jan 4, 2024
6f29025
.
AstitvaAggarwal Jan 5, 2024
338c2a5
updated BPINN_PDEinvsol_tests.jl, commented out BPINN_PDE_tests.jl
AstitvaAggarwal Jan 5, 2024
6f2908f
commented out print statement in BPINN_PDEinvsol_tests.jl
AstitvaAggarwal Jan 5, 2024
6e7539f
update BPINN_PDEinvsol_tests.jl
AstitvaAggarwal Jan 5, 2024
659ef59
update runtests.jl
AstitvaAggarwal Jan 5, 2024
4ef549d
changed Mvnormal def in pde Loglikelihoods
AstitvaAggarwal Jan 5, 2024
b02e97c
TIL: avoid depreciated methods on CI
AstitvaAggarwal Jan 5, 2024
ec9048d
Changes from reviews(dispatch etc)
AstitvaAggarwal Jan 6, 2024
7b1ea42
Can use diff training_strategies, Implemented dispatch on discretization
AstitvaAggarwal Jan 7, 2024
4683d74
update discretize.jl
AstitvaAggarwal Jan 7, 2024
185e2d5
update BPINN_PDE_tests.jl
AstitvaAggarwal Jan 7, 2024
1c64bec
update PDE_BPINN.jl
AstitvaAggarwal Jan 7, 2024
cf3dc1f
update BPINN_PDEinvsol_tests.jl
AstitvaAggarwal Jan 7, 2024
8008f3a
Update src/discretize.jl
ChrisRackauckas Jan 7, 2024
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
1 change: 1 addition & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
matrix:
group:
- ODEBPINN
- PDEBPINN
- NNPDE1
- NNPDE2
- AdaptiveLoss
Expand Down
2 changes: 1 addition & 1 deletion docs/src/tutorials/Lotka_Volterra_BPINNs.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ plot!(solution, labels = ["true x" "true y"])
We can see the estimated ODE parameters by -

```@example bpinn
sol_pestim.estimated_ode_params
sol_pestim.estimated_de_params
```

We can see it is close to the true values of the parameters.
29 changes: 16 additions & 13 deletions src/BPINN_ode.jl
Original file line number Diff line number Diff line change
Expand Up @@ -148,21 +148,24 @@ end
BPINN Solution contains the original solution from AdvancedHMC.jl sampling(BPINNstats contains fields related to that)
> ensemblesol is the Probabilistic Estimate(MonteCarloMeasurements.jl Particles type) of Ensemble solution from All Neural Network's(made using all sampled parameters) output's.
> estimated_nn_params - Probabilistic Estimate of NN params from sampled weights,biases
> estimated_ode_params - Probabilistic Estimate of ODE params from sampled unknown ode paramters
> estimated_de_params - Probabilistic Estimate of DE params from sampled unknown de paramters
AstitvaAggarwal marked this conversation as resolved.
Show resolved Hide resolved
"""
struct BPINNsolution{O <: BPINNstats, E,
NP <: Vector{<:MonteCarloMeasurements.Particles{<:Float64}},
OP <: Union{Vector{Nothing},
Vector{<:MonteCarloMeasurements.Particles{<:Float64}}}}

struct BPINNsolution{O <: BPINNstats, E, NP, OP, P}
original::O
ensemblesol::E
estimated_nn_params::NP
estimated_ode_params::OP

function BPINNsolution(original, ensemblesol, estimated_nn_params, estimated_ode_params)
estimated_de_params::OP
timepoints::P

function BPINNsolution(original,
ensemblesol,
estimated_nn_params,
estimated_de_params,
timepoints)
new{typeof(original), typeof(ensemblesol), typeof(estimated_nn_params),
typeof(estimated_ode_params)}(original, ensemblesol, estimated_nn_params,
estimated_ode_params)
typeof(estimated_de_params), typeof(timepoints)}(original, ensemblesol, estimated_nn_params,
estimated_de_params, timepoints)
end
end

Expand Down Expand Up @@ -260,14 +263,14 @@ function DiffEqBase.__solve(prob::DiffEqBase.ODEProblem,
end

nnparams = length(θinit)
estimnnparams = [Particles(reduce(hcat, samples)[i, :]) for i in 1:nnparams]
estimnnparams = [Particles(reduce(hcat, samples[(end - numensemble):end])[i, :]) for i in 1:nnparams]

if ninv == 0
estimated_params = [nothing]
else
estimated_params = [Particles(reduce(hcat, samples[(end - ninv + 1):end])[i, :])
estimated_params = [Particles(reduce(hcat, samples[(end - numensemble):end])[i, :])
for i in (nnparams + 1):(nnparams + ninv)]
end

BPINNsolution(fullsolution, ensemblecurves, estimnnparams, estimated_params)
BPINNsolution(fullsolution, ensemblecurves, estimnnparams, estimated_params, t)
end
26 changes: 14 additions & 12 deletions src/NeuralPDE.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,21 @@ include("discretize.jl")
include("neural_adapter.jl")
include("advancedHMC_MCMC.jl")
include("BPINN_ode.jl")
include("PDE_BPINN.jl")

export NNODE, TerminalPDEProblem, NNPDEHan, NNPDENS, NNRODE,
KolmogorovPDEProblem, NNKolmogorov, NNStopping, ParamKolmogorovPDEProblem,
KolmogorovParamDomain, NNParamKolmogorov,
PhysicsInformedNN, discretize,
GridTraining, StochasticTraining, QuadratureTraining, QuasiRandomTraining,
WeightedIntervalTraining,
build_loss_function, get_loss_function,
generate_training_sets, get_variables, get_argument, get_bounds,
get_phi, get_numeric_derivative, get_numeric_integral,
build_symbolic_equation, build_symbolic_loss_function, symbolic_discretize,
AbstractAdaptiveLoss, NonAdaptiveLoss, GradientScaleAdaptiveLoss,
MiniMaxAdaptiveLoss,
LogOptions, ahmc_bayesian_pinn_ode, BNNODE
KolmogorovPDEProblem, NNKolmogorov, NNStopping, ParamKolmogorovPDEProblem,
KolmogorovParamDomain, NNParamKolmogorov,
PhysicsInformedNN, discretize,
GridTraining, StochasticTraining, QuadratureTraining, QuasiRandomTraining,
WeightedIntervalTraining,
build_loss_function, get_loss_function,
generate_training_sets, get_variables, get_argument, get_bounds,
get_phi, get_numeric_derivative, get_numeric_integral,
build_symbolic_equation, build_symbolic_loss_function, symbolic_discretize,
AbstractAdaptiveLoss, NonAdaptiveLoss, GradientScaleAdaptiveLoss,
MiniMaxAdaptiveLoss, LogOptions,
ahmc_bayesian_pinn_ode, BNNODE, ahmc_bayesian_pinn_pde, vector_to_parameters,
BPINNsolution

end # module
Loading
Loading