-
-
Notifications
You must be signed in to change notification settings - Fork 197
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
better BPINN formulation, improvements to include dataset domain points #842
base: master
Are you sure you want to change the base?
Conversation
src/collocated_estim.jl
Outdated
# PDE(DU,U,P,T)=0 | ||
|
||
# Derivated via Central Diff | ||
# function calculate_derivatives2(dataset) | ||
# x̂, time = dataset | ||
# num_points = length(x̂) | ||
# # Initialize an array to store the derivative values. | ||
# derivatives = similar(x̂) | ||
|
||
# for i in 2:(num_points - 1) | ||
# # Calculate the first-order derivative using central differences. | ||
# Δt_forward = time[i + 1] - time[i] | ||
# Δt_backward = time[i] - time[i - 1] | ||
|
||
# derivative = (x̂[i + 1] - x̂[i - 1]) / (Δt_forward + Δt_backward) | ||
|
||
# derivatives[i] = derivative | ||
# end | ||
|
||
# # Derivatives at the endpoints can be calculated using forward or backward differences. | ||
# derivatives[1] = (x̂[2] - x̂[1]) / (time[2] - time[1]) | ||
# derivatives[end] = (x̂[end] - x̂[end - 1]) / (time[end] - time[end - 1]) | ||
# return derivatives | ||
# end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's this all about?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
initially wrote this for testing, while figuring out which kind of derivative is to be used in new loss. the above was the case where the derivative was datapoint interpolation derivatives via central diff.
src/collocated_estim.jl
Outdated
# A1 = (prob.u0' .+ | ||
# (prob.tspan[2] .- (dataset[end]' .+ sqrt(eps(eltype(Float64)))))' .* | ||
# chainflux(dataset[end]' .+ sqrt(eps(eltype(Float64))))') | ||
|
||
# A2 = (prob.u0' .+ | ||
# (prob.tspan[2] .- (dataset[end]'))' .* | ||
# chainflux(dataset[end]')') | ||
|
||
A1 = chainflux(dataset[end]' .+ sqrt(eps(eltype(dataset[end][1])))) | ||
A2 = chainflux(dataset[end]') | ||
|
||
gradients = (A2 .- A1) ./ sqrt(eps(eltype(dataset[end][1]))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You shouldn't use this for gradients?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not anymore, i wrote this for it to work for a specific case, normally the same is done using the derivative function NNodederi in the BPINN ode solver.
There's a lot of random stuff together in here. Break this apart into simple one thing PRs and lets merge those. |
@AstitvaAggarwal do you think you can make this into multiple smaller PRs as Chri suggested above? |
Yes, will do |
@ChrisRackauckas @Vaibhavdixit02 I've seperated the code into two PRs. one for the better ode solver and this for the PDE solver. |
this one is still having issues with tests passing? |
yes, Im wrapping up the tests file for the modifications. Repeating a few runs as NUTS sampler dosent cause the chains to converge well enough. |
PR related tests should pass... also improvement is seen at any added noise level. Verified MCMC chain convergence via trace plots mixing and Autocorrelation drop between parameters. |
Checklist
contributor guidelines, in particular the SciML Style Guide and
COLPRAC.
Additional context
will add docs and more tests separately