-
-
Notifications
You must be signed in to change notification settings - Fork 195
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
API for parameters does not take np.array type #1198
Comments
@sbenthall could you help me with this? I'm not familiar with the logging features of HARK |
I'm confused about how to reproduce this error.
So I haven't gotten to the logging issue yet. |
OK, I've replicated this error by working from the |
Correct, this happens in the |
The error is happening because:
Did If so, how shall we compute |
Hello Sebastian and Alan,
Just to be clear, are you all referring to the cstw.ipynb file that can be reached from “https://github.com/econ-ark/DistributionOfWealthMPC”?
I was able to reproduce some of the errors that were in the previous email but not all of them.
I’ve looked through the HARK repo but can’t find a similar cstw.ipynb file there.
Decory
From: Sebastian Benthall ***@***.***>
Date: Monday, January 9, 2023 at 5:09 PM
To: econ-ark/HARK ***@***.***>
Cc: Decory Edwards ***@***.***>, Mention ***@***.***>
Subject: Re: [econ-ark/HARK] Logging errors (Issue #1198)
External Email - Use Caution
The error is happening because:
* The value of self.conditions['GICRaw'] is an np.array, [True].
* This value is being passed to messages[self.conditions[name]] as a key to the dictionary messages
* The keys of messages are expected to be booleans, not arrays of booleans.
* The condition that is causing the failure is the one tested by check_GICNrm. This is hard to discover, because there is an error in the code whereby this conditions has the name GICRaw -- probably an error from copying and pasting code.
* The reason why the result of its test is an array [True] is because self.thorn is a single-valued array.
* The reason why self.thorn is a single-valued array is because self.DiscFac is a single-valued array.
Did self.DiscFac become array-valued in some recent change to HARK? Is that because it is time-varying? Or otherwise multivalued?
If so, how shall we compute thorn?
—
Reply to this email directly, view it on GitHub<https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fecon-ark%2FHARK%2Fissues%2F1198%23issuecomment-1376396124&data=05%7C01%7Cdedwar65%40jhu.edu%7C32821fc2497e4e5dcd2d08daf28e21db%7C9fa4f438b1e6473b803f86f8aedf0dec%7C0%7C0%7C638088989510239544%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=NGviKfzJNJ5gNbTahxneTm1ikZkaZxKlJduJu4rOor0%3D&reserved=0>, or unsubscribe<https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAR3YDSJY2PEN5JXNT4PKPOTWRSEAHANCNFSM6AAAAAATO7OBWQ&data=05%7C01%7Cdedwar65%40jhu.edu%7C32821fc2497e4e5dcd2d08daf28e21db%7C9fa4f438b1e6473b803f86f8aedf0dec%7C0%7C0%7C638088989510239544%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Zh23SS9xD5izByDmBWOKJkFZxbyKotDjUCcqcJvTMwY%3D&reserved=0>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
@dedwar65 The notebook is here: https://github.com/econ-ark/DistributionOfWealthMPC/blob/master/cstwMPC.ipynb If I recall correctly, the whole point of the DistributionOfWealthMPC paper is that the @alanlujan91 do you know if this logging error happens with HARK pinned to 0.12, or is it the updates to get it to work with |
|
@sbenthall error does not happen in econ-ark=0.12 |
Thinking this over -- I am doubtful that it is a good idea to patch HARK with this change. There is already something in https://github.com/econ-ark/HARK/blob/master/HARK/ConsumptionSaving/ConsIndShockModel.py#L2054-L2055 So it would require some severe abuse of the API if Since this was not a problem with earlier HARK versions, it is most likely that this bug was introduced in DistributionofWealthMPC. In other words, HARK is working as expected, and the fix should be done in the DistributionofWealth repo. |
Hmmm... there is one condition under which it would make sense to patch HARK, but it would be a more general issue. Currently, we have scalar values (e.g. floats) for parameters, and optionally lists if a parameter is time-varying. We could conceivably change the HARK API to accomodate array-valued parameters. Maybe that could be part of a broader effort to make the API more strongly type. This is discussed here: #664 But this is a bigger effort than should be done for the 0.13.0 release. |
This relates to the project that @alanlujan91 and I had sketched in which we would basically make everything age-varying (in principle). We should discuss the way forward in depth at some future meeting. |
I think I found the bug and it is unrelated to logging or Discount Factor being time varying. Since HARK 0.11 the representation of discrete distributions has changed, from 1 dimensional vectors to 2 dimensional where the second dimension indexes the random variable for multidimensional random variables. |
Describe the bug
Logging results in errors on DistributionOfWealthMPC, see econ-ark/DistributionOfWealthMPC#4
HARK/HARK/ConsumptionSaving/ConsIndShockModel.py
Lines 1948 to 1950 in 65c76c8
To Reproduce
Steps to reproduce the behavior:
cstwMPC.ipynb
Expected behavior
DistributionOfWealthMPC should work with HARK@master branch. It works when these lines are commented out.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Additional context
@llorracc @wdu9 @dedwar65 critical to update DistributionOfWealthMPC
The text was updated successfully, but these errors were encountered: