Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] PolicyBrain API #354

Closed
wants to merge 5 commits into from
Closed

[WIP] PolicyBrain API #354

wants to merge 5 commits into from

Conversation

jdebacker
Copy link
Member

This PR attempts to bring OG-USA into line with the PolicyBrain API using Issue #352 as a guide.

@jdebacker jdebacker changed the title PolicyBrain API [WIP] PolicyBrain API Mar 9, 2018
@hdoupe
Copy link
Contributor

hdoupe commented Mar 9, 2018

@jdebacker This looks good so far. I quickly sketched out how I think an OG-USA parameters class would look on this branch. It will need to be filled in and integrated with OG-USA, but for the purposes of reasoning about the API, I think it should do.

What do you think? Do you think that type of approach could work?

cc @martinholmer

@jdebacker
Copy link
Member Author

@hdoupe Thanks for your work in the other branch. I have a number of questions. The first two are:

  1. Do I need to put all parameter values currently specified in parameters.py into the default_parameters.json file?
  2. I'm not sure where in the process of running OG-USA the pb_api.py script you created will come into play? We might need to set up a time to chat to help me understand this.

@hdoupe
Copy link
Contributor

hdoupe commented Mar 14, 2018

I think moving the hard-coded parameters into the default_parameters.json document is a good idea. In the future, we could think about splitting it up into different categories like Tax-Calculator's consumption.json, growdiff.json, etc.

I think that instead of doing all of the parameter validation and processing in places like this in execute.py or like this in parameters.py we could do it in pb_api.py or in a new, refactored parameters.py.

A call sounds good--just sent you a message to set that up.

"out_of_range_maxmsg": "",
"out_of_range_action": "stop",
"compatible_data": {"puf": true, "cps": true}
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jdebacker how is MINIMIZER_OPTIONS used? I did a search in the code base and can see where it's set but not where it is used.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hdoupe You are right - it is not used. I'll drop this from the JSON.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, sounds good.

@jdebacker
Copy link
Member Author

Deleted unused MINIMIZER_OPTIONS from JSON.

Added @hdoupe's work on pb_api.py -- with some additional called to cheap parameter computations.

@hdoupe
Copy link
Contributor

hdoupe commented Mar 27, 2018

@jdebacker this looks good so far.

I put some thought into some of the questions you posed:

How can I:
i) check things like that lambdas.sum=1? Length J
ii) what to do with world_int_rate dictionary?
iii) Checking tG1 vs tG2 vs T
iv) Check that tau_bq is of length J
v) How to choose set of test parameters (small state space) easily
vi) Checking consistency of baseline_spending with other options
vii) how handle dask parameters?
viii) How handle baseline boolean? paths?

i, iv, vi) We may have to do the initial range validation and then do further validation on these more complex requirements.

v) Is this something that we could specify with the parameters in the JSON files? If so, could you just create a JSON file like the Tax-Calculator presets that specifies the test parameters?

vii) Would it make sense to include those in the model_solution_parameters.json file?

viii) I feel like the baseline boolean parameter could be included in the default_parameters.json file? However, it seems like it might make more sense to keep that as a normal variable that is passed along and not specified in a JSON file. But, I'm not really sure. I don't think the paths necessarily have to be specified in a JSON file either.

iii) I was able to get a working solution for this which allows you to set the range for a parameter like:

"range": {"min": f(other_parameter_name, constant), 'max': g(other_parameter_name, constant)}

where f or g is either:
value of other_parameter_name + constant
value of other_parameter_name - constant
value of other_parameter_name * constant
value of other_parameter_name / constant

All of this is on my ogusa-paramsbase branch. The function that extends the range capabilities is here and it's called from here. I need to spend some time cleaning up the code, documenting, and adding a test or two.

Then, I could open up a PR on this branch that you are working on. Opening a PR on a PR is kind of a clumsy way to integrate changes, but I don't know of a better way to do it. If you want to try another process, then we can talk about that.

@hdoupe
Copy link
Contributor

hdoupe commented Apr 4, 2018

See jdebacker#9 for further implementation of the pb_api.py module in this PR.

@asmockler
Copy link
Contributor

@jdebacker Anything I can do to help move this along? Or are there things listed in #352 that I could do independent of the work happening here?

@jdebacker
Copy link
Member Author

@asmockler As you can see, my work on this branch has been intermittent and I just set out the basics of the parameter defaults and so on as outline by @hdoupe.

I feel like I need to think more about how OG-USA needs to be restructured to work better with the PolicyBrain API and forthcoming changes to PB. At the moment, I'm having hard time thinking of places to make small independent contributions because I don't have an exact idea what the final structures should look like. Let's put any discussion over in Issue #352 or new issues.

@jdebacker
Copy link
Member Author

@hdoupe I'm closing this PR, but there is some good discussion here (e.g., about where one might place more complex parameter validation). PR #419 has completed many of the tasks laid out here.

@jdebacker jdebacker closed this Nov 9, 2018
@jdebacker jdebacker deleted the pb_api branch November 9, 2018 01:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants