-
Notifications
You must be signed in to change notification settings - Fork 18
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
Unscented Kalman Inversion #8
Conversation
This looks great! Thanks Daniel, let's have a chat about incorporating this into the EKP framework. I see 2 parts to it (Please others chime in if you disagree):
struct Unscented <: Process
uki_param1::P1
uki_param2::P2
end
update_ensemble!(ekp::EnsembleKalmanProcess{FT, IT, Unscented},...) It's fine for you to keep everything in the current file you have. Let's see how easily we can do this! PS. you call it an optimization method - is it not an approximate UQ method? |
Codecov Report
@@ Coverage Diff @@
## main #8 +/- ##
=======================================
Coverage ? 91.18%
=======================================
Files ? 5
Lines ? 454
Branches ? 0
=======================================
Hits ? 414
Misses ? 40
Partials ? 0
Continue to review full report at Codecov.
|
@odunbar I have updated with Unscented process, could you have a look? |
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.
It's looking better! We need to update the function so that it is more like
update_ensemble!(uki, u^{n}, G(u^{n}))
and the output is u^{n+1}
.
I think this is possible by setting ourselves up to calculate
- In the constructor, for EKP copy-paste the lines 558-584: and define the
init_params = construct_sigma_ensemble(process, u_p_mean, uu_p_cov)
(as this doesn't rely upon the model right?) - remove applying G within
update_ensemble
and instead apply G to u_p in the outer loop (in the example script) and pass in the data matrix "G(u_p)" into update_ensemble - update_ensemble now effectively starts at line 589-610, and then move the block 558-584 to the end of this currently written function so that it ends with creating then new
u_p
.
If this doesn't make sense I'm happy to meet. But it looks good!
I feel giving the operator G to the update_ensemble will make the code much clearer. Is there any difference calling G in/out of the update_ensemble function? I am thinking about running EKP with other black box code, like fortran GCM, how do you handle it ? |
Well in complex applications we may not be able to simply "call G" in the update ensemble, that's the issue. I agree your current implementation is nice and clean but this code is likely going to be hooked to possibly nasty models (e.g the climate model scenario). The way we handle it with the blackbox code is:
END) iterate 2-3 until desired convergence/iterations step 2) could be literally anything, in the GCM setting it often requires writing parameters into run-files, then setting off ensemble of simulations on HPC that reads these different files (currently based on bash and Slurm scripts), then postprocessing all the data. Working with parameters and data, rather than distributions and functions, is just more flexible here. step 2) takes (\theta^n_i) -> G(\theta^n_i) and |
Ok, I updated it , could you have a look? |
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.
This should be the last iteration and then I think we are done. Although we will need some runtests for this.
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.
Thanks for the latest revision!
The source code / examples look good to me. (i have one small comment)
All we need now are the runtests
, So we need something to run through your source functions so the codecov is happy. Let me know if you want to chat about how to set these up.
src/EnsembleKalmanProcess.jl
Outdated
Δt = Array([Δt]) | ||
|
||
EnsembleKalmanProcess{FT, IT, Unscented}(init_params, obs_mean, obs_noise_cov, N_ens, g, | ||
err, Δt, process) |
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.
Missing indentation
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.
updated
A minor thing: Could the ordering be changed such that the |
In the construction of an |
Also: I think that we should have a separate "cosmetic" PR that takes care of things like proper doc strings for functions (unless it's totally obvious what they do, e.g., getters and setters), making variable names consistent (e.g., the variables denoting the dimension of the data include "N_y", "data_dim", and "output_dim"), etc., in the entire module. Establishing these conventions will make things easier down the road, as people typically use the existing code base as a starting point/template for developing their contributions. |
Yes, we should have a docstrings PR in to make these more clear for users |
Updated, thanks! |
I am not sure how to modify this one, I just tried to make unscented Kalman inversion constructor look like the others, and reuse these data structures |
Updated a calibration test (3) in the runtest |
@bielim if you could create issue(s) for this? Certainly I am hoping we can do a docs push in the next couple of for EKP and CES which will i hope will help with both writing docstrings and enforcing more consistency as we get more eyes looking over it |
Done! |
Any further change requests? Should I rebase and merge? @bielim @odunbar |
LGTM! Thanks |
add Cloudy test add Lorenz test
bors r+ |
Build succeeded: |
Implement the unscented Kalman inversion [1] in the EKP library
The method is a general derivative-free optimization approach for inverse problems
Several examples are presented
The convergence of the mean and 3-sigma of the three transformed variables and the true values are
The convergence of the mean and 3-sigma of the three transformed variables and the true values are