Forecasting code cleanup - #285
Conversation
Includes ForecastSimulator, ParticleFilterSimulator, and EnsembleKalmanFilterSimulator as top-level interfaces.
…naries of unknown parameters to have consistent usage of keys when iterating over them.
…hood with an `EnsembleKalmanFilterSimulator`.
… likelihood in terms of standard deviation for consistency. Added and updated documentation and annotations.
…naries of unknown parameters to have consistent usage of keys when iterating over them.
…hood with an `EnsembleKalmanFilterSimulator`.
… likelihood in terms of standard deviation for consistency. Added and updated documentation and annotations.
…/Epymorph into Forecasting-Code-Cleanup
JavadocMD
left a comment
There was a problem hiding this comment.
Looking much better, thanks! Just a few minor things, see inline.
…valued hyperparameters.
…e "realizations" as the first dimension.
|
Is it possible to split up some of the code in |
There are a number of tricks to accomplish this. For instance, notice the epymorph.tools.data module defines its own You can also move certain foundational entities to a third module, if they don't require many imports themselves. There are certain guidelines that can help organize imports; I thought about enforcing them with tools at one point. Anyway, I'm happy to chat about specifics if it's helpful. |
|
Thank you! That’s very helpful. |
* Plotting functionality. * Error correction. * Typing * modified: epymorph/forecasting/filter_plot.py * Finally?
* Refactor filter to reduce code repetition. * Added support for non-Gaussian likelihoods in the EnKF. * Added support for observing multiple strata. * Allow unknown params to use wildcards. * Refactor filter to reduce code repetition. * Added support for non-Gaussian likelihoods in the EnKF. * Added support for observing multiple strata. * Allow unknown params to use wildcards. * Cleaned up redundant shape calculations.
* Refactor filter code. * Moved pipeline_messaging * Typing updates. * Updated documentation. * Formatting.
JavadocMD
left a comment
There was a problem hiding this comment.
In addition to the inline comment, I noticed epymorph.forecasting.dynamic_params is importing dataclass from attr instead of dataclasses -- use dataclasses.
There are some documentation warnings, but we don't necessarily have to resolve those here. (uv run mkdocs build to see the list.)
|
I made some improvements to the typing and handling of parameters to address Tyler's comments. |
Refactor and reorganization of the filtering-to-forecasting workflow. Class names are now more explicit and the API is more consistent across classes. Also includes plotting functionality for the output of pipeline simulations. * Implementation of the filtering and forecasting pipeline subsystem. Includes ForecastSimulator, ParticleFilterSimulator, and EnsembleKalmanFilterSimulator as top-level interfaces. * Updated type annotations. Added ABC to abstract classes. * Added override decorator as appropriate. Updated operations on dictionaries of unknown parameters to have consistent usage of keys when iterating over them. * Added validation upon construction for only using a `Gaussian` likelihood with an `EnsembleKalmanFilterSimulator`. * Renamed likelihoods to be more explicit. Reparameterized the Gaussian likelihood in terms of standard deviation for consistency. Added and updated documentation and annotations. * Updated type annotations. Added ABC to abstract classes. * Added override decorator as appropriate. Updated operations on dictionaries of unknown parameters to have consistent usage of keys when iterating over them. * Added validation upon construction for only using a `Gaussian` likelihood with an `EnsembleKalmanFilterSimulator`. * Renamed likelihoods to be more explicit. Reparameterized the Gaussian likelihood in terms of standard deviation for consistency. Added and updated documentation and annotations. * Updated line formatting. * Updated documentation. * Changed validation of dynamic parameters to work properly with array-valued hyperparameters. * Changed the `posterior_values` of the particle filter and EnKF to have "realizations" as the first dimension. * Forecasting code cleanup (#293) * Plotting functionality. * Error correction. * Typing * modified: epymorph/forecasting/filter_plot.py * Finally? * EnKF refactor (#294) * Refactor filter to reduce code repetition. * Added support for non-Gaussian likelihoods in the EnKF. * Added support for observing multiple strata. * Allow unknown params to use wildcards. * Refactor filter to reduce code repetition. * Added support for non-Gaussian likelihoods in the EnKF. * Added support for observing multiple strata. * Allow unknown params to use wildcards. * Cleaned up redundant shape calculations. * Messaging and refactor of pipeline simulators. (#295) * Refactor filter code. * Moved pipeline_messaging * Typing updates. * Updated documentation. * Formatting. * Reorganized internal forecasting utility functions. * Updated typing in FilterOutput. * Added support for movement data by visit or home node in pipeline simulators. * Typing and doc improvements in the munge. * modified: tests/fast/tools/data_test.py * modified: epymorph/forecasting/munge_realizations.py * Updated typing, documentation, and naming conventions for pipeline plots. * Fixed incorrect import. * Adjusted typing for plotting on multiple matplotlib axes. * Updated documentation and typing. --------- Co-authored-by: Avery Drennan <aad473@nau.edu> Co-authored-by: averydx <avery.drennan@gmail.com>
Miscellaneous cleanup which includes: