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

GWR poisson: local variable 'aicc' referenced before assignment #58

Closed
ghost opened this issue Jun 24, 2019 · 1 comment
Closed

GWR poisson: local variable 'aicc' referenced before assignment #58

ghost opened this issue Jun 24, 2019 · 1 comment
Labels
bug Something isn't working doc

Comments

@ghost
Copy link

ghost commented Jun 24, 2019

I used the following codes to do the bandwidth selection for GWR Poisson but got an error saying "local variable 'aicc' referenced before assignment"

import libpysal as ps
from mgwr.sel_bw import Sel_BW
import numpy as np
from spglm.family import Poisson
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])
bw = Sel_BW(coords, y, X, kernel='gaussian', family = Poisson).search(criterion='AICc')

@weikang9009
Copy link
Member

for the last step, add a bracket after Poisson:
bw = Sel_BW(coords, y, X, kernel='gaussian', family = Poisson()).search(criterion='AICc')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working doc
Projects
None yet
Development

No branches or pull requests

1 participant