hyunjimoon / hyunjimoon/DataInDM

Some interface design decisions regarding input data, outcome in data2draws

Open
#22 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
3
Forks
0
PR merge metrics
No merged PRs in 30d

Description

A rough implementation of data2draws is partly implemented. You can write the following python code:
```
model = StanVensimModel("ds_white_sterman", am, 0.0, list(range(0, 10))) # 0.0 is initial time, range(0, 10) is the integrations times
model.set_prior("inventory_adjustment_time", "normal", 0, 1)
model.set_prior("minimum_order_processing_time", "normal", 0, 1)
```

This (currently) results in the following generated code:
```
#include ds_white_sterman_functions.stan

data{
}

transformed data{
real initial_time = 0.0;
int T = 10;
array[T] real times = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
}

transformed parameters {
# Initial ODE values
real inventory_initial = 2 + 2 * 10000;
real expected_order_rate_initial = 10000;
real work_in_process_inventory_initial = 8 * max(0,10000 + 2 + 2 * 10000 - 2 + 2 * 10000 / 8);

vector[3] initial_outcome; # Initial ODE state vector
initial_outcome[1] = inventory;
initial_outcome[2] = expected_order_rate;
initial_outcome[3] = work_in_process_inventory;

vector[3] integrated_result[T] = ode_rk45(vensim_ode, initial_outcome, initial_time, times, minimum_order_processing_time, inventory_adjustment_time);
}

parameters{
real inventory_adjustment_time;
real minimum_order_processing_time;
}

model{
inventory_adjustment_time ~ normal(0, 1);
minimum_order_processing_time ~ normal(0, 1);
}
```

The problem is how we're going to expose `vector[3] integrated_result[T]` to the user. There are 2 ways the user would want to access it. 1. along the time axis(which results in a array of length `T` with a single stock) 2. for a single timestep(which results in a vector of length 3)

Another problem is linking the codegen with data specified by the user. I'm not sure what form the data would have to be inputted from the user. If data was specified, we'd have to construct the data block that matches the inputted data.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.