Closed sbenthall closed 5 months ago
While doing a full replacement with dolo IIDProcesses would be major change--maybe one more appropriate for 2.0 Dolark integration, a more moderate change would be to the necessary refactoring to start mirroring Dolo.
I.e., to make a ContinuousDistribution class with a draw method, and subclass it for each particular distribution.
This sort of move would move HARK towards equivalence with Dolo, which would become apparent in the DARKolos.
That's an excellent idea. Go for it.
Interesting: SymPy has stats
support: https://docs.sympy.org/latest/modules/stats.html
Mathematica processes: https://reference.wolfram.com/language/guide/RandomProcesses.html
Based on @albop 's presentation, it sounds like we want to replace the HARK Distribution classes with dolo Distribution classes
Now there is even further lack of feature parity between HARK distributions and dolo IID processes, because of the new calcExpectations
functionality #625 The closest equivalent in Dolo is 'integrate, but this does not meet all of the requirements @mnwhite put into place with
calcExpectations`
Given the time available for delivering 1.0, I will move this ticket to a later milestone. Full HARK/Dolo integration is an admirable goal, but it will be much easier to do after HARK is further refactored into elements that are similar to Dolo's.
HARK currently has several functions in
simulation
for drawing from continuous distributions:drawMeanOneLognormal
drawLognormal
drawNormal
drawWeibull
drawUniform
drawBernoulli
This is custom code that has been implemented in many other libraries. In particular, we can move towards integration with Dolo by replacing this code with calls to the 'simulate()` method in the Dolo IIDProcess class, e.g.: https://github.com/EconForge/dolo/blob/master/dolo/numeric/processes_iid.py#L114
There are some complications here:
It's possible that the HARK functions and Dolo do not have feature parity. A few observations:
draw
functions have:exact_match
option -- I frankly don't understand what this does yetseed
for the random generatorsimulate
has:T
argument. What is this?stochastic
argument. What is this?simulate
implemented for the LogNormal distribution, and has no class for the Weibull distributionThe automated tests for HARK depend on the current
draw_
code, including the random seed setting. Swapping in Dolo will require recalibration of all the tests. This will make it difficult to guarantee that the new code does not introduce any errors.This would introduce a direct dependency between HARK and Dolo. This is the direction it sounds like @llorracc wants to go. However, from an open-source development perspective, Dolo does not currently have any documented contribution guidelines. Does it have a release cycle or stable releases? It's not clear how this dependency will effect HARK's development process.
[This is related to #519, which is about discrete distributions. Currently in HARK, continuous distributions are handled entirely separately, in
simulation.py
, from discrete distributions, which at the time of this writing are inutilities.py
(changing with #610). Dolo IIDProcesses support discretization, so this change is instrumental to syncing up these functionalities.]