OpenSourceEconomics / lcm

Solution and simulation of life cycle models in Python with GPU acceleration.
Apache License 2.0
16 stars 1 forks source link

Improve simulation output #36

Closed timmens closed 1 year ago

timmens commented 1 year ago

In this PR, we change the simulation output from a list of dicts containing the simulated choices (on dict for each period) , to a data frame with multiindex (periods, initial_states_id) and columns corresponding to choices, states and targets (auxiliary variables that might be of interest).


After this simulation call

    res = simulate_model(
        params,
        vf_arr_list=vf_arr_list,
        initial_states={
            "wealth": jnp.array([1.0, 20, 40, 70]),
        },
        targets=["utility"],
    )

the output will look like this:

Screenshot 2023-10-04 at 10 23 31

codecov[bot] commented 1 year ago

Codecov Report

Merging #36 (ff3ac76) into main (7962873) will increase coverage by 0.06%. Report is 1 commits behind head on main. The diff coverage is 100.00%.

:exclamation: Current head ff3ac76 differs from pull request most recent head a1a43e2. Consider uploading reports for the commit a1a43e2 to get more accurate results

@@            Coverage Diff             @@
##             main      #36      +/-   ##
==========================================
+ Coverage   98.45%   98.52%   +0.06%     
==========================================
  Files          38       38              
  Lines        1947     1969      +22     
==========================================
+ Hits         1917     1940      +23     
+ Misses         30       29       -1     
Files Coverage Δ
src/lcm/simulate.py 98.48% <100.00%> (+0.28%) :arrow_up:
tests/test_simulate.py 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes