econ-ark / HARK

Heterogenous Agents Resources & toolKit
Apache License 2.0
335 stars 198 forks source link

Code for DiscreteDistribution #1192

Closed nomadj1s closed 4 months ago

nomadj1s commented 1 year ago

Describe the bug The code on this repository for HARK.distribution.DiscreteDistribution does not seem to match what is used when you call HARK from a conda install. Where can I see the most up to date code?

To Reproduce Steps to reproduce the behavior:

  1. run conda install -c conda-forge econ-ark
  2. run the following:
from HARK.ConsumptionSaving.ConsIndShockModel import IndShockConsumerType

HARKExample = IndShockConsumerType()
HARKBase2.TranShkDstn[0].pmv
  1. The following error is returned:
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/var/folders/bm/65k97f4j77q2bn74yvqyjk3c0000gq/T/ipykernel_39862/698395917.py in <module>
----> 1 HARKBase2.TranShkDstn[0].pmv

AttributeError: 'DiscreteDistribution' object has no attribute 'pmv'

Expected behavior On this repository, HARK.distribution.DiscreteDistribution has a class for DiscreteDistribution that has pmv as an attribute. However, when HARK is loaded via conda it is using a different class, that has attributes such as pmf and X. I expected the code on this repository to reflect what was being used by HARK when installed via conda.

Screenshots N/A

Desktop (please complete the following information):

Additional context N/A

alanlujan91 commented 1 year ago

The most up to date code is on the master branch of the repository which can be installed by

pip install git+https://github.com/econ-ark/HARK.git

When you install from conda, you get version econ-ark=0.12 which was released almost a year ago. We have not had a release since.

nomadj1s commented 1 year ago

@alanlujan91: Is there a branch of the repository that has the underlying code for version 0.12?

Thanks

alanlujan91 commented 1 year ago

yes, you can see the source code for version 0.12 at https://github.com/econ-ark/HARK/tree/0.12.0

llorracc commented 1 year ago

@nomadj1s,

Thanks for posting this (and your earlier posts).

@alanlujan91 is right that you can see the source code at the link he provided.

But if you installed it via conda install you should also be able to find it at whatever location conda already installed it under when you executed the conda install command. I don't remember exactly how to figure that out, but Google will.

In any case, your example should work because it is using the standard instructions.

@alanlujan91, can you work with @nomadj1s to see if you can get it working for him? And, more importantly, to resolve the bug (in the sense that it seems like @nomadj1s did what you're supposed to do and it didn't work). "resolving" might mean fixing our instructions, fixing our code, or otherwise trying to prevent future users from having @nomadj1s's problems.

nomadj1s commented 1 year ago

@llorracc and @alanlujan91: That link works fine for me, thanks! I didn't know the version from conda was different than the version on your master branch, but now everything makes sense.

alanlujan91 commented 1 year ago

@nomadj1s no worries, let us know if you have other questions about the library. We have not had a release since December 2021 but are in discussions to have a new release soon, for which there will be some breaking changes. We'll have to be very explicit about what those are on the release notes.

mnwhite commented 4 months ago

Several releases have happened now! More will happen! Exciting times! Closing!