Skip to content
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

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

Closed
kkyyhh96 opened this issue Aug 24, 2020 · 6 comments
Closed

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

kkyyhh96 opened this issue Aug 24, 2020 · 6 comments

Comments

@kkyyhh96
Copy link

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
Copy link

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
Copy link
Member

Ziqi-Li commented Aug 24, 2020

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
Copy link

shughestr commented Aug 25, 2020 via email

@TaylorOshan
Copy link
Collaborator

Solved in #83

@shughestr
Copy link

shughestr commented Sep 18, 2020 via email

@Ziqi-Li
Copy link
Member

Ziqi-Li commented Sep 18, 2020

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants