-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
Problems evaluating Koopman Expectations over large parameter space #98
Comments
I'm not sure if this is driving the memory issue, but the default quadrature alg is probably only good up to 10 dimensions. You can set |
Your |
Ah thanks, that's good to know. Changing from the default Changing to
Meanwhile, changing to
Could this be something to do with only having uncertainty over the parameters, but none over the initial conditions? |
I think your
|
I seem to have it running now, I actually had an issue in my I'm now trying to get the full observable out, so the mean and 2nd moment for every state at every saved timestep. Is it valid to do something like |
I think you will need to unroll. I doubt Integrals.jl can support what you are asking. You could possible try some fancy vector type like ComponentArrays.jl to keep everything partitioned. I would test that using Integrals.jl directly with a MWE |
Thanks, I've got it working now by doing
to concatenate all the solution values together, and then
after which I just split and reshape the resulting I've attached the full trace of the results to illustrate (top), as well as the trace that I should be getting (bottom, as a result of doing a regular solve on just the The above was with |
It's also probably worth noting that I'm pinning the truncation of my parameters' normal distributions to be positive by doing p_dist = [truncated(Normal(r, ru), max(r-(4*u), 0.0), r+(4*u)) for (r, u) in zip(rates, rate_uncertainties)] as none of these rate constants should be negative, but this shouldn't be affecting things with the |
I will admit that I've never tried this technique on a system with both a large number of uncertain dimensions AND a large observable vector. It is most likely a matter of tuning the integration parameters. Note that when you consider a vector valued observable like you are the tolerencing is with respect to some norm of the observation vector. Some of the integration methods allow you to change the norm and others don't. Intergrals.jl just wraps other integration packages into a common interface. You may want to check the upstream docs. Just to try to isolate the issue I would try something like form an integrand of nout = 2 * length(saveat) * n_states normal pdfs and try integrating it directly using Integrals.jl. It should give 1 everywhere, but it may help you get a feel for the play between the norm, tolerances, and other integration parameters |
Okay thanks, will give that a go. Just to check, do the |
This is exactly why |
solve(exprob, Koopman(); quadalg=CubatureJLh(),
ireltol=1e-3, iabstol=1e-3) For setting spatial integration tols. Note, it looks like they are SciMLExpectations.jl/src/expectation.jl Line 137 in 4e8cbaf
|
That's exactly what I was looking for, thanks. I'll have a play around with those and see if I can get it working properly. |
I'm still testing things out, but just a point of note. My initial condition
Each column is a state, and each row is a saved timestep. The values for every other column just repeat, within floating point error. Can poor integrator tolerances alone explain this kind of behaviour, or could something else be causing a problem? Also I switched to using non-truncated distributions, as in #74, and can confirm that it seems to be working (at least I'm getting the same results that I was getting before anyway). |
"Working" as in gives the correct answer? In the end I think you need a simpler MWE to determine if this is a bug and where it might reside. |
"Working" as in functioning without a crash or error and giving the same results as above, i.e. unchanged from what I was getting with the truncated distributions. Just thought I'd include it as a point of note on the back of the other issue. |
Hi, first time using the package so I apologise if I'm missing something obvious.
I'm trying to propagate parametric uncertainty through a large, stiff system of ODEs representing a chemical reaction network (previous discussion here) using Koopman Expectations, such that I have a normal distribution over each of my
ODESystem
parameters and I am able to observe the mean and standard deviation over my state vector at every timestep specified bysaveat
. Here is my setup:As far as I can tell this is set up correctly, but please correct me if not.
When I run this, it gets into the
solve()
line and then errors with the following:Watching my system memory usage at the time indicates that I really shouldn't be running out of memory (~7 GB / 32 GB used when it errors), so I'm really not sure what to make of the issue. I'd like this to work on systems of >2000 ODES with > 7000 parameters, but right now this crash is happening on a much smaller system of 20 ODEs with only 36 parameters (hence the Rosenbrock23 solver, I usually use QNDF).
The text was updated successfully, but these errors were encountered: