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

Export HARK model to Dolang #659

Open
sbenthall opened this issue Apr 27, 2020 · 11 comments
Open

Export HARK model to Dolang #659

sbenthall opened this issue Apr 27, 2020 · 11 comments

Comments

@sbenthall
Copy link
Contributor

Given a HARK model, export it to a Dolang yaml file.

@sbenthall sbenthall added this to the 2.x.y milestone Apr 27, 2020
@sbenthall
Copy link
Contributor Author

One aspect of this problem is for Distribution objects to be able to export their specification in Dolang syntax: https://github.com/econ-ark/DARKolo/blob/master/chimeras/BufferStock/bufferstock.yaml#L32-L34

@albop
Copy link
Collaborator

albop commented Apr 27, 2020 via email

@sbenthall
Copy link
Contributor Author

Exporting DIstribution objects in Dolang syntax is relatively easy compared to other parts of the HARK model export.

But one thing that has to happen before this is useful for exporting HARK models is that where possible HARK parameters should be entered as Distributions, rather than as the parameters themselves.

See
#620

@sbenthall
Copy link
Contributor Author

Hmm, I must correct myself.
The distributions would need to maintain their parameters in symbolic form for the conversion to work.

@llorracc
Copy link
Collaborator

The ideal solution to this would be a scheme in which HARK models are specified natively in such a way that they can be exported to Dol[ARK/o] yaml files directly.

But a way to get started moving toward this goal would be simply to add strings to a HARK model articulating the various components of the corresponding Dol* model file.

This might seem like makework, but I think working through a few test cases like this would have a number of advantages:

  1. It will uncover any examples of things that we can do in HARK but that DolARK/Dolo cannot   
    • For example, there is currently no way to do subperiods in Dolo.
         * Probably there are other examples that will come up and that can then be added to the priority list for new capabilities for Dol[ARK/o]
  2. It will provide a description of a model that is complete and specific, rather than leaving a great deal unspecified;
       * This should make it possible for others to solve our models in other languages1. It will help us see how we need to restructure our models
       * To make it possible to achieve the longer-term goal
  3. It might also help us to regularize our notation and usage across models   
    • In particular, we may find that we want define a specification for mapping HARK variable names to Dolo names
  4. It is a task that should not require too high a level of specialized knowledge, and therefore could be assigned to newcomers to the project
  5. It would help us differentiate aspects of the solution that we think of as not fundamental to the "real" model but instead fundamental to the computational approximation to the "real" model
    • For example, we might specify that in the "real" model a shock should be lognormally distributed, but in our computational solution we pick a certain kind of discretization of the lognormal with a certain number of points.
    • To the extent that computational solutions differ because of arbitrary choices like these, we could define the "truth" as the limiting version of the model when the approximations become arbitrarily good

@sbenthall
Copy link
Contributor Author

OK, you have convinced me this would be a useful exercise.

@sbenthall
Copy link
Contributor Author

It will uncover any examples of things that we can do in HARK but that DolARK/Dolo cannot

I wonder what the right workflow here would be.

Suppose that some feature is not in dolang.
Would the next step be to file an issue on dolang? on dolark?

@sbenthall
Copy link
Contributor Author

It will provide a description of a model that is complete and specific, rather than leaving a great deal unspecified;

How would these strings differ from the LaTeX in the corresponding notebook files?

If they are in dolang syntax, but they contain features that are not currently in dolang, then the correct way to write the string would be unspecified until dolang is expanded.

It would help us differentiate aspects of the solution that we think of as not fundamental to the "real" model but instead fundamental to the computational approximation to the "real" model

I see this as very desirable from the standpoint of cleaning up the software design, which I'm still trying to focus on as it's a dense problem that I'm starting to make headway on.

@llorracc
Copy link
Collaborator

It will provide a description of a model that is complete and specific, rather than leaving a great deal unspecified;

How would these strings differ from the LaTeX in the corresponding notebook files?

They would be in Dol* syntax

If they are in dolang syntax, but they contain features that are not currently in dolang, then the correct way to write the string would be unspecified until dolang is expanded.

My sense is that these strings would be a good way to think through how to develop the new syntax that dolang will need to capture the new features we need. They would also provide a ready-made testbed for trying out the new syntax when it is introduced (by going back and correctly specifying the model in the new syntax and then seeing if it is parsed correctly).

It would help us differentiate aspects of the solution that we think of as not fundamental to the "real" model but instead fundamental to the computational approximation to the "real" model

I see this as very desirable from the standpoint of cleaning up the software design, which I'm still trying to focus on as it's a dense problem that I'm starting to make headway on.
It's also a real-world problem: Now, when people get different quantitative answers from what looks like the same model, it is difficult to know whether:

  1. There is actually some subtle but quantitatively important difference between the models being compared
  2. One or the other of the models is incorrect (there's a bug somewhere)
  3. The differences are due to arbitrary choices like the number of gridpoints
    • In which case the model that is closer to "right" is the one that is closer to the limiting solution as the number of gridpoints goes to infinity

@sbenthall
Copy link
Contributor Author

It's also a real-world problem: Now, when people get different quantitative answers from what looks like the same model

I think some of what you are getting at with this can be addressed directly in the parameter handling. I've made #660 for this.

@llorracc
Copy link
Collaborator

#659 (comment) is a good start. See comment there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants