pysal / mgwr

Multiscale Geographically Weighted Regression (MGWR)
https://mgwr.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
360 stars 126 forks source link

AttributeError: 'tuple' object has no attribute 'shape' #84

Closed kkyyhh96 closed 3 years ago

kkyyhh96 commented 4 years ago

When I was running the example code of the project, I met the following error: image

---> 2 mgwr_bw = mgwr_selector.search() AttributeError: 'tuple' object has no attribute 'shape'

I only ran the cell [1]-[3] and then [5]-[6]. My python version is 3.8 on Ubuntu. The mgwr version is 2.1.1.

Please note that to read the data I unzipped the zip file and used the following code: prenz = gp.read_file(ps.examples.get_path('prenzlauer.shp'))

shughestr commented 4 years ago

ran the example code at https://mgwr.readthedocs.io/en/latest/generated/mgwr.gwr.GWR.html#mgwr.gwr.GWR
tried #basic model calibration, which is import libpysal as ps from mgwr.gwr import GWR data = ps.io.open(ps.examples.get_path('GData_utm.csv')) coords = list(zip(data.by_col('X'), data.by_col('Y'))) y = np.array(data.by_col('PctBach')).reshape((-1,1)) rural = np.array(data.by_col('PctRural')).reshape((-1,1)) pov = np.array(data.by_col('PctPov')).reshape((-1,1)) african_amer = np.array(data.by_col('PctBlack')).reshape((-1,1)) X = np.hstack([rural, pov, african_amer]) model = GWR(coords, y, X, bw=90.000, fixed=False, kernel='bisquare')

also returned: AttributeError: 'tuple' object has no attribute 'shape'

Python3.8. Any comments or suggestions?

Ziqi-Li commented 4 years ago

Hello @kkyyhh96 and @shughestr,

I locate the problem. This happened because a recent update on spreg hasn't been reflected in the mgwr. There is a current open PR #83 from @weikang9009 should fix this problem, but it hasn't been merged yet.

A temporary fix would be to pin spreg to an earlier version e.g. v.1.1.1. pip install spreg==1.1.1.

Cheers, Ziqi

shughestr commented 4 years ago

You are right, rolling back version does solve the problem! Thanks.

On Mon, Aug 24, 2020 at 1:47 PM Ziqi Li notifications@github.com wrote:

Hello @kkyyhh96 https://github.com/kkyyhh96 and @shughestr https://github.com/shughestr,

I locate the problem. This happened because a recent update on spreg hasn't been reflected in the mgwr. There is a current open PR #83 https://github.com/pysal/mgwr/pull/83 from @weikang9009 https://github.com/weikang9009 should fix this problem, but it hasn't been merged yet.

A temporary fix would be to pin spreg to an earlier version e.g. v.1.1.1. pip install spreg==1.1.1.

Cheers,

Ziqi

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pysal/mgwr/issues/84#issuecomment-679357378, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMUI22SNW76QHL3KFAOL7B3SCLGVHANCNFSM4QJZM7JQ .

TaylorOshan commented 3 years ago

Solved in #83

shughestr commented 3 years ago

Hi Ziqi,

We are still experiencing some issues with the GWR approach/library. We wonder if you'll have time to have a quick Zoom chat with us. We have applied SVM, Ridge Regression, XGBoost on the dataset. As we are new in this field, we can really use your help and guidance.

Just FYI, I am working on a pro bono basis with some graduate students in Canadian universities on a Real Estate price trend forecast project. I currently work for a Canadian government agency.

Let me know. Thanks.

Regards, Dave Dong

On Mon, Aug 24, 2020 at 10:04 PM tip red s.hughes.tr@gmail.com wrote:

You are right, rolling back version does solve the problem! Thanks.

On Mon, Aug 24, 2020 at 1:47 PM Ziqi Li notifications@github.com wrote:

Hello @kkyyhh96 https://github.com/kkyyhh96 and @shughestr https://github.com/shughestr,

I locate the problem. This happened because a recent update on spreg hasn't been reflected in the mgwr. There is a current open PR #83 https://github.com/pysal/mgwr/pull/83 from @weikang9009 https://github.com/weikang9009 should fix this problem, but it hasn't been merged yet.

A temporary fix would be to pin spreg to an earlier version e.g. v.1.1.1. pip install spreg==1.1.1.

Cheers,

Ziqi

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pysal/mgwr/issues/84#issuecomment-679357378, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMUI22SNW76QHL3KFAOL7B3SCLGVHANCNFSM4QJZM7JQ .

Ziqi-Li commented 3 years ago

Hi Ziqi, We are still experiencing some issues with the GWR approach/library. We wonder if you'll have time to have a quick Zoom chat with us. We have applied SVM, Ridge Regression, XGBoost on the dataset. As we are new in this field, we can really use your help and guidance. Just FYI, I am working on a pro bono basis with some graduate students in Canadian universities on a Real Estate price trend forecast project. I currently work for a Canadian government agency. Let me know. Thanks. Regards, Dave Dong

Hi Dave. I could do that, could you send me an email at liziqi1992[at]gmail.com?