Code Monkey home page Code Monkey logo

un-og-training's People

Contributors

jdebacker avatar rickecon avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

un-og-training's Issues

Error with glue command in section 16

There was a problem in running the glue command in 16.3.1 and 16.3.2. In the last line of the command for tabular output and plotting output the glue command does not work.

Specifically, these are the commands that do not work for each block of code, respectively:
(i) glue(table.to_markdown())
(ii) glue(fig.show())

The problem can be partially resolved by:
(i) installing the glue package: "conda install myst-nb"
(ii) importing the glue package: "from myst-nb import glue

However, the glue command still gives the following error in both blocks of code:
"NameError: name 'glue' is not defined"

Thank you.

Python version for environment

Currently we are pinning our Python version to be >= 3.10, which resulted in my installing 3.11 in the un-og-training-dev environment.

I now want to install ogzaf to use in some example solutions, but that is only compatible with Python <= 3.10. Shall up change the pin in OG-ZAF or in the environment for this project?

Calibrating pensions

How should we explain the calibration of pensions? Right now, OG-Core only parameterizes a social security style system.

Reading pickled `Specifications` object in Python 3.11

In PR #24, I inserted the following code block into the OG/Ouput.md chapter:

import ogcore.output_tables as ot
from io import BytesIO
import pickle
import requests
path_dict = {
    "TPI": [
        "https://github.com/PSLmodels/OG-Core/blob/master/tests/test_io_data/TPI_vars_baseline.pkl?raw=true",
        "https://github.com/PSLmodels/OG-Core/blob/master/tests/test_io_data/TPI_vars_reform.pkl?raw=true"
            ],
    "Params": [
        "https://github.com/PSLmodels/OG-Core/blob/master/tests/test_io_data/model_params_baseline.pkl?raw=true",
        "https://github.com/PSLmodels/OG-Core/blob/master/tests/test_io_data/model_params_reform.pkl?raw=true"

    ]
}
output_dict = {
    "TPI": [],
    "Params": []
}
for key in path_dict.keys():
    for path in path_dict[key]:
        r = requests.get(path)
        output_dict[key].append(pickle.load(BytesIO(r.content)))
# make table
table = ot.macro_table(output_dict["TPI"][0], output_dict["Params"][0], output_dict["TPI"][1], output_dict["Params"][1], output_type="pct_diff", num_years=10, start_year= output_dict["Params"][0].start_year)

I have no issue executing this in Python 3.10. But with Python 3.11, there is an error with the pickle.load command when trying to read the pickle file containing the model parameters (which is a ogcore.parameters.Specifications object pickled with Cloudpickle). The traceback is:

TypeError                                 Traceback (most recent call last)
Cell In[2], line 24
     22     for path in path_dict[key]:
     23         r = requests.get(path)
---> 24         output_dict[key].append(pickle.load(BytesIO(r.content)))
     25 # make table
     26 table = ot.macro_table(output_dict["TPI"][0], output_dict["Params"][0], output_dict["TPI"][1], output_dict["Params"][1], output_type="pct_diff", num_years=10, start_year= output_dict["Params"][0].start_year)

TypeError: code() argument 13 must be str, not int

I've tried just using cloudpickle and pickle.loads to unpack and still get an error.

Calibrating tax functions

How much detail should we add about calibrating tax functions? We must assume most countries won't have microsimulation models to link to. Given that, do we present just linear? Show how to estimate Gouveia-Strauss with aggregate data?

Minor code typo in Chapter 15

Thanks for filing an issue! Please remove any top-level headers that do not apply.

There was a minor typo in the second block of code for Chapter 15 (Simulating OG-Core), which prevented the code from running:
....
p_reform.update_specifications({'CIT_rate': [[0.15]]})
....

When I changed CIT to lower case, the code worked.

GitHub Action push.yaml not working

The push.yaml GitHub Action is not working. This GH Action is meant to run after a PR is merged (when changes are pushed to the main repository). It automatically updates the repository version and deploys the updated Jupyter Book documentation to the gh-pages branch for the documentation website. However, the "Checkout Repo" action is the first to run, and it is failing with the following error.

/usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +d030ba2c5deb85175cf58e1e616c97ac7bdeab0f:refs/remotes/origin/main
  Error: fatal: could not read Username for 'https://github.com/': terminal prompts disabled
  The process '/usr/bin/git' failed with exit code 128
GHactionError

I think this must be some issue with the GitHub secret used in the GH Action. But I can't figure it out. This action works great in my fiscalsim-us repository.

cc: @jdebacker

Need better render option for BYU ACME PDF docs

We use the BYU Applied and Computational Math Emphasis open access Python labs in these training materials. We link to their 2021-2022 materials because those labs are individually packaged and the PDF format displays separately for each of them. It is a little less easy to use the most recent 2023-2024 materials, which are packaged as multi-chapter single PDF files (here and here) that have to be downloaded as .zip files that the students would have to search through. The updates to the 2023-2024 materials are fairly small, but they are significant in some places (e.g., discussion of fstrings in Exceptions and file I/O chapter). Below are some options of what we can do.

  1. Current approach. Link to 2021-2021 labs and add supplementary exercises and content for areas that need to be updated.
  2. Link to 2023-2024 labs and just have our users download the .zip files and search through to the correct chapters
  3. Save the individual PDF files somewhere like Google Drive where they can be pulled up as full PDF files in users' browser.
  4. Rewrite each ACME lab as is but as a .md file that can be rendered in the Jupyter Book. This is what the ACME labs should transition to anyway. Maybe this would help them.
  5. Write our own .md training content and exercises.

cc: @jdebacker

Missing Chapter 16 in the OG-Core Training Material

Thanks for filing an issue! Please remove any top-level headers that do not apply.

After working through Chapter 15 (Simulating OG-Core), I was unable to work through any of the code in Chapter 17 (OG-Core Output). I think this may be due to the missing chapter in the training material, i.e., Chapter 16.

Thank you.

Exercise 16.2 fails due to wrong dimensions

On step 16.2 the calculation of non_stationary_Y fails because the two variables have different dimensions.

non_stationary_Y = TPI_vars["Y"] * np.cumprod(1 + p.g_n) * np.exp(p.g_y * np.arange(p.T))
print(non_stationary_Y

gives the error:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[16], line 1
----> 1 non_stationary_Y = TPI_vars["Y"] * np.cumprod(1 + p.g_n) * np.exp(p.g_y * np.arange(p.T))
      2 print(non_stationary_Y)

ValueError: operands could not be broadcast together with shapes (320,) (400,) 

The dimensions are:
TPI_vars["Y"].shape = (320,)
p.g_n.shape = (400,)

This breaks exercise 16.2.

cc: @sezdi0810 @GuBenda

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.