Vensim -> InferenceData/Arviz #268
Replies: 5 comments 2 replies
-
thanks for sharing. i'm so glad. agenda2 for today would be to brainstorm a heuristic rule for issue vs discussions in this repository. we can use action trigger so that opening / closing the issue can automatically update the project schedule. charlie asked to have suggest some milestone for the tools i'm building and it'd be really helpful to chat about potential goal / milestone of this project. relevant threads are i added this repository to GitHub Copilot Chat and am experimenting what it does. |
Beta Was this translation helpful? Give feedback.
-
I'm still pursuing the approach of making this mostly Python side, but most of the work has to start on the Vensim side. So far:
|
Beta Was this translation helpful? Give feedback.
-
There's a little more to do on the Vensim side:
|
Beta Was this translation helpful? Give feedback.
-
There's at least one imminent question: the InferenceData schema includes a number of 'groups' that are tables for particular kinds of output. If you're importing from Stan or some other known source, things are directed to the right group. However, when importing from dataframes from an unknown source, the documentation/examples are extremely vague about how you direct the incoming data to the right group. |
Beta Was this translation helpful? Give feedback.
-
perhaps of interest on automated sbc idea 4. SBC_WhoUser-Program WF: One actor and its tool
Bayesian WF: Between three modules
SilkRoad WF: Between six softwares (
|
Step | Output | Software | Symbol | Description | opensource? (language) |
---|---|---|---|---|---|
1. Program Perceived Demand |
a. Perceived Demand | Vensim | 👁 Eye | Reads mental model, Translates to cyclic directed graph generator |
X (has free version) |
1. | b. Analyzed Demand | SDA | 🧠 Brain | Finds dominant cycle of generator , Maps with system behavior |
O (Mathematica, R) |
- | |||||
2. Compute Scientific Draws |
a. Computed Draws | Stan | 🐴 Workhorse | Builds posterior space, Runs HMC, ADVI, BFGS for representative draws | O (Stan connected to Python, R, Julia) |
2. | b. Verified and Validated Draws | SBC | 👌 Test | Diagnoses graphically, Calibrates architecture, policy, parameter prior discriminator |
O (R) |
- | |||||
3. Collect Supporting Data |
a. Theoretical Policy Parameter | BATS (communicating with Yaman, Gönenç) | 🦇 Explore | Specifies policy parameter for demanded behavior | O (Python) |
3. | b. Empirical Policy Parameter | SOPS (communicating with Erling) | 🚀 One-shot | Optimizes policy one-shot in stochastic dynamic system | O (Powersim) |
- | |||||
Iterate and communicate | Hub pysd , readsdr |
PySD, readsdr | 🗣 Language | O (Python, R) |
Beta Was this translation helpful? Give feedback.
-
Just FYI, I've started working on this, after improving a few minor things in the Vensim MCMC implementation.
Looking at the docs, it seems like this should be primarily on the Python side. It think Vensim should generate a couple output files that make import into InferenceData easy, probably via Pandas dataframes (because that's an easy way to import tab or csv).
As a sanity check:
The InferenceData schema consists of a number of 'groups' each of which is an n-dimensional table, which may have a couple of standard dimensions ('chain', 'draw', 'sample') as well as some model-specific dimensions. Not all of these groups will be relevant for Vensim.
Posterior is easy - this is basically the runname_MCMC_sample file we now create.
unconstrained_posterior - not relevant
sample_stats - seems to be mainly HMC stuff - not relevant - a few things like acceptance rate correspond, but not sure it's worth the trouble initially.
log_likelihood corresponding with the posterior samples - also easy. Currently this is in the _points file, but that format isn't really convenient, so it would be better to create a separate file or column in the _sample file to make import easier.
log_prior corresponding with the posterior samples - also easy. However, for this and the previous item, we'll need to introduce some separation in the payoff (.vpd) so that the prior and data likelihood can be distinguished. Currently we don't identify which is which. This is mainly a UI question.
posterior_predictive - this will take a little automation, to generate a sensitivity run using the posterior sample. Should be pretty easy. I think existing savelist functionality can be used to identify the relevant variables to include (for large models, definitely not everything). Seems like the mindset here is posterior predictives corresponding with the observed_data, but policy variables would also be interesting.
observed_data - I think this might be messy, because the data could enter the payoff directly via a *C item, or the user might have some custom structure in the model for model-data comparisons. In the latter case, it wouldn't be easy to automatically identify the data and include it. Also, Vensim data is typically going to have nonuniform time axes and big variations in dimensionality. This seems like a version 2.0 item.
constant_data - Also messy, for the same reasons. Would be good to have for documentation and comparison purposes, but storing everything is redundant, and could run towards a gigabyte or more for a big model. Maybe have a UI for storing only policy relevant changes that reflect experimentation, not defaults?
prior - a prerequisite for doing this is identification of prior components from the payoff (as in log_prior above). Not sure Vensim has a strong motivation for generating samples from the prior by themselves.
prior_predictive - combines issues of the posterior_predictive and prior above.
predictions - out of sample predictions seem like they have definite utility. For Vensim, normally this is going to mean "predictions about the future" and it seems a little weird to have them in a separate table when really they are just extensions of the time dimension.
predictions_constant_data - Like constant_data, good for documentation but maybe not essential right away, since the model/vdfx also document this.
Beta Was this translation helpful? Give feedback.
All reactions