tapios / risk-networks

Code for risk networks: a blend of compartmental models, graphs, data assimilation and semi-supervised learning
Other
2 stars 2 forks source link

Updates of EAKF codes to improve efficiency #159

Closed jinlong83 closed 4 years ago

jinlong83 commented 4 years ago

This PR implements the EAKF codes with following updates:

dburov190 commented 4 years ago

Also, as a side note (which is nevertheless quite relevant), do we need to compute the EAKF error at each step? as far as I can tell, it is only used for dummy output which has close to zero meaning for us (we'll see the errors in plots anyway); meanwhile, the compute_error method solves a linear system (of general form) twice, which is again almost equal to asymptotic complexity of SVD. As a result, it takes 11 seconds on my laptop to solve just one system for a 10000 network!

I think we can turn it off and only use when needed.

odunbar commented 4 years ago

Re: compute_error. We could toggle it. It's useful for testing but not for the running of the code

odunbar commented 4 years ago

Thanks for your points Dima. I agree with your desired need to clean up the flags and the outdated parameter noise. Also on this:

I thought the whole idea of using SVD on zp instead of Sigma was not to construct Sigma explicitly. Currently, it is being constructed (line 136) no matter what

These lines I had moved in my version of EAKF over to the Full SVD part of the statement only, we should do this again.

I'll make some changes later. Jinlong, are there any parts of data_assimilator that you changed or are the changes all from a merge with Dima's new branch?

jinlong83 commented 4 years ago

Thanks for all your comments Dima. They are quite helpful. In terms of data_assimilator, the only change I made is about setting flags of EnsembleAdjustmentKalmanFilter (which is not necessary actually). I would suggest that we only merge ensemble_adjustment_kalman_filter.py into master branch if it's easier.

odunbar commented 4 years ago

@dburov190 @jinlong83 I have made some changes to the EAKF:

Performance changes: 1) Construction of Sigma from zp happens only in the full SVD option 2) compute_error has a flag (default = True)

Other Changes, 3) I have switched flags to be "xyz_reduced" not "xyz_full" as in some sense the reduced part is how you actively increase the speed of the code, the full option is the original. If you don't like this you can change it back. 4) I have changed the if - else statements. We have 2 svds, with bools, but the decision space is only {(0,0),(0,1),(1,1)} for example, so i give both options with a nonimplemented error for option (1,0). This enables us to write the latter if-else statements in a non-nested fashion. 5) I've removed some of the comments (one of your's Jinlong you write as on-going so I have left this atm).