mggg / ecological-inference

Ecological inference, in Python
MIT License
28 stars 11 forks source link

rxc error #52

Closed bblpo closed 2 years ago

bblpo commented 3 years ago

when running rxc, keep getting error:

ValueError: Input dimension mis-match. (input[0].shape[1] = 99, input[1].shape[1] = 2)

this same error even reappeared when I switched to your own default data on santa_clara-demo, though they had different shape values.

where do I fix these parameters?

karink520 commented 3 years ago

Hi Baodong, Thanks for asking. If you're getting those errors even running our examples, which should run, I'd guess perhaps there is a version issue going on. I would start by checking: 1) that the environment where you're running PyEI has the same versions of the packages that PyEI depends on as are listed in requirements.txt (in particular, we currently pin to pymc3 3.9.3 and arviz 0.11.1). You could check this by inspecting, e.g. pm.version in your python interpreter, and 2) that you're running the latest version of PyEI itself.

(You'd also want to be sure that the dimensions of your inputs are correct: votes_fractions would have shape c x num_precinct, group_fraction is r x num_precinct, and precinct_pops is length num_precincts, but those shapes are correct in the examples we provide, so I don't think that's the root of the problem in your case.)

bblpo commented 3 years ago

Thank you so much for your quick response. Is it possible that it is my python version issue? I have been using Python 3.7, not 3.8.

From: karink520 @.> Reply-To: mggg/ecological-inference @.> Date: Saturday, April 24, 2021 at 7:21 AM To: mggg/ecological-inference @.> Cc: BAODONG LIU @.>, Author @.***> Subject: Re: [mggg/ecological-inference] rxc error (#52)

Hi Baodong, Thanks for asking. If you're getting those errors even running our examples, I'd guess perhaps there is a version issue going on. I would start by checking: 1) that the environment where you're running PyEI has the same versions of the packages that PyEI depends on as are listed in requirements.txt (in particular, we currently pin to pymc3 3.9.3 and arviz==0.11.1) and 2) that you're running the latest version of PyEI itself.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/mggg/ecological-inference/issues/52#issuecomment-826092236, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AISSRIEHOWBH5CKODY7BGQ3TKLAVBANCNFSM43PPYN7Q.

karink520 commented 3 years ago

Hi Baodong, Thanks for asking - I don't think that Python version should be an issue, since we test PyEI on 3.7 and 3.8. You checked the pymc3 and arviz versions? That was really my strongest suspicion for what's going on here! - Karin

bblpo commented 3 years ago

Thanks, Karin.

I did check the pymc3 and arviz which are older versions than your newer requirements.

One puzzle is that I installed your older versions and all requirements in December of last year and I used your codes back then (not the updated one here) and still got the error messages, which suggests that a particular line about shape should have three components, but only two were found. I went back to your older coding and didn't find which line was problematic.

I will try to install your updated version and all requirements up to date on a different machine, and see what happens.

bblpo commented 3 years ago

Hi Karin,

Thanks again for your help with the RxC model. I wonder whether pymc3.10.0 will work? Should I go with the most updated version 3.11 or force it 3.9.3, the exact (older) version you recommended?

Baodong

From: karink520 @.> Reply-To: mggg/ecological-inference @.> Date: Monday, April 26, 2021 at 7:43 AM To: mggg/ecological-inference @.> Cc: BAODONG LIU @.>, Author @.***> Subject: Re: [mggg/ecological-inference] rxc error (#52)

Hi Baodong, Thanks for asking - I don't think that Python version should be an issue, since we test PyEI on 3.7 and 3.8. You checked the pymc3 and arviz versions? That was really my strongest suspicion for what's going on here! - Karin

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/mggg/ecological-inference/issues/52#issuecomment-826846008, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AISSRIGNYTAB2KVSWLG775LTKVUWLANCNFSM43PPYN7Q.

bblpo commented 3 years ago

Hi Karin,

Thanks again for all your assistances on RxC.

I have completely changed/upgraded my packages as you instructed including pymc3==3.9.3 and Arvis==0.11.1

I also reinstalled PyEI from your git page.

So everything is in accordance with your instructions. But I still had the shape issue, if I use my own data: ValueError: Input dimension mis-match. (input[0].shape[1] = 99, input[1].shape[1] = 2)

If I used your own demon data, the error message was about the import the data itself: ImportError: cannot import name 'Datasets' from 'pyei.data' (/home/.local/lib/python3.7/site-packages/pyei/data.py)

I may be wrong. But it seems like either your python code had some error, or there are still some hidden issues.

Also, the following two lines from your example seemed to be an issue and I could not succeed whether or included them in my code or not: %load_ext autoreload %autoreload 2

Thanks so much.

Baodong

From: karink520 @.> Reply-To: mggg/ecological-inference @.> Date: Monday, April 26, 2021 at 7:43 AM To: mggg/ecological-inference @.> Cc: BAODONG LIU @.>, Author @.***> Subject: Re: [mggg/ecological-inference] rxc error (#52)

Hi Baodong, Thanks for asking - I don't think that Python version should be an issue, since we test PyEI on 3.7 and 3.8. You checked the pymc3 and arviz versions? That was really my strongest suspicion for what's going on here! - Karin

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/mggg/ecological-inference/issues/52#issuecomment-826846008, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AISSRIGNYTAB2KVSWLG775LTKVUWLANCNFSM43PPYN7Q.

bblpo commented 3 years ago

Hi again,

Hi Karin,

My last email was not entirely correct. I did get your demo data correctly loaded, but it still produced the error message on shape. Wondering whether I needed a particular version of Theano.

Thanks.

Baodong

From: BAODONG LIU @.> Date: Monday, May 3, 2021 at 9:07 PM To: mggg/ecological-inference @.>, mggg/ecological-inference @.> Cc: Author @.> Subject: Re: [mggg/ecological-inference] rxc error (#52)

Hi Karin,

Thanks again for all your assistances on RxC.

I have completely changed/upgraded my packages as you instructed including pymc3==3.9.3 and Arvis==0.11.1

I also reinstalled PyEI from your git page.

So everything is in accordance with your instructions. But I still had the shape issue, if I use my own data: ValueError: Input dimension mis-match. (input[0].shape[1] = 99, input[1].shape[1] = 2)

If I used your own demon data, the error message was about the import the data itself: ImportError: cannot import name 'Datasets' from 'pyei.data' (/home/.local/lib/python3.7/site-packages/pyei/data.py)

I may be wrong. But it seems like either your python code had some error, or there are still some hidden issues.

Also, the following two lines from your example seemed to be an issue and I could not succeed whether or included them in my code or not: %load_ext autoreload %autoreload 2

Thanks so much.

Baodong

From: karink520 @.> Reply-To: mggg/ecological-inference @.> Date: Monday, April 26, 2021 at 7:43 AM To: mggg/ecological-inference @.> Cc: BAODONG LIU @.>, Author @.***> Subject: Re: [mggg/ecological-inference] rxc error (#52)

Hi Baodong, Thanks for asking - I don't think that Python version should be an issue, since we test PyEI on 3.7 and 3.8. You checked the pymc3 and arviz versions? That was really my strongest suspicion for what's going on here! - Karin

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/mggg/ecological-inference/issues/52#issuecomment-826846008, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AISSRIGNYTAB2KVSWLG775LTKVUWLANCNFSM43PPYN7Q.

karink520 commented 3 years ago

Hi Baodong,

Please feel free to email me at karin.knudson@tufts.edu if it might be easier to schedule a time to chat/troubleshoot live about this - we're thrilled that you're using PyEI and don't want getting set up with the right dependencies to be a blocker. (And if we do chat, I'd also be curious to hear more about how you're using (or hoping to use) PyEI, and what future features might be valuable to your research. For example, I saw your note about covariates in the other issue thread. Thanks for sharing - we want PyEI to be as useful as possible, so this kind of feedback is appreciated!)

karink520 commented 2 years ago

I'm going to close this issue for now. Since it was specific to the computing-environment, I believe it was a dependency issue that I think would no longer apply now that we've removed the pin to an earlier version of pymc3.