You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hello guys. does anyone know how to do it? I've tried every kernel but it didn't work. I would appreciate it if you'd love to help me.
this is my first use of github so i don't know how to upload my code except copy. Sorry about that.
here is my code:
import numpy as np
import pysal as ps
from mgwr.gwr import GWR, MGWR
from mgwr.sel_bw import Sel_BW
import pandas as pd
georgia_data = pd.read_csv('C:/Users/DELL/Desktop/georgia/GData_utm.csv')
g_y = georgia_data['17s'].values
g_X = georgia_data[['17sr', '17gas_proportion', '17energy_intensity', '17structure', '17per_gdp', '17population']].values
u = georgia_data['X']
v = georgia_data['Y']
g_coords=list(zip(u,v))
bw=Sel_BW(g_coords, g_y, g_X, kernel='gaussian').search(criterion='AIC')
print(bw)
F:\anaconda\lib\site-packages\mgwr\gwr.py in _local_fit(self, i)
246 Local fitting at location i.
247 """
--> 248 wi = self._build_wi(i, self.bw).reshape(-1, 1) #local spatial weights
249
250 if isinstance(self.family, Gaussian):
F:\anaconda\lib\site-packages\mgwr\gwr.py in _build_wi(self, i, bw)
234
235 try:
--> 236 wi = Kernel(i, self.coords, bw, fixed=self.fixed,
237 function=self.kernel, points=self.points,
238 spherical=self.spherical).kernel
F:\anaconda\lib\site-packages\mgwr\kernels.py in init(self, i, data, bw, fixed, function, eps, ids, points, spherical)
54 self.bandwidth = float(bw)
55 else:
---> 56 self.bandwidth = np.partition(
57 self.dvec,
58 int(bw) - 1)[int(bw) - 1] * eps #partial sort in O(n) Time
<array_function internals> in partition(*args, **kwargs)
F:\anaconda\lib\site-packages\numpy\core\fromnumeric.py in partition(a, kth, axis, kind, order)
746 else:
747 a = asanyarray(a).copy(order="K")
--> 748 a.partition(kth, axis=axis, kind=kind, order=order)
749 return a
750
ValueError: kth(=62) out of bounds (30)
The text was updated successfully, but these errors were encountered:
thanks for your attention. I've read the issue#88 so I tried other kernels. maybe it's my data problem? ☹️
that's ok if you wanna close this issue. I will other ways
anyway, thanks again😊
--------------原始邮件--------------
发件人:"Ziqi Li ***@***.***>;
发送时间:2021年6月4日(星期五) 晚上9:20
收件人:"pysal/mgwr" ***@***.***>;
抄送:"zlh1998ecnu ***@***.***>;"Mention ***@***.***>;
主题:Re: [pysal/mgwr] kth out of bounds (#96)
-----------------------------------
Hello @zlh1998ecnu, this may relate to issue #88. Also, feel free to attach a copy of the data, so we could have a closer look.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
Uh oh!
There was an error while loading. Please reload this page.
hello guys. does anyone know how to do it? I've tried every kernel but it didn't work. I would appreciate it if you'd love to help me.
this is my first use of github so i don't know how to upload my code except copy. Sorry about that.
here is my code:
ValueError Traceback (most recent call last)
in
10 v = georgia_data['Y']
11 g_coords=list(zip(u,v))
---> 12 bw=Sel_BW(g_coords, g_y, g_X, kernel='gaussian').search(criterion='AIC')
13 print(bw)
F:\anaconda\lib\site-packages\mgwr\sel_bw.py in search(self, search_method, criterion, bw_min, bw_max, interval, tol, max_iter, init_multi, tol_multi, rss_score, max_iter_multi, multi_bw_min, multi_bw_max, bws_same_times, pool, verbose)
317 -1] #scalar, optimal bw from initial gwr model
318 else:
--> 319 self._bw()
320 self.sel_hist = self.bw[-1]
321
F:\anaconda\lib\site-packages\mgwr\sel_bw.py in _bw(self)
335 self.constant)
336 delta = 0.38197 #1 - (np.sqrt(5.0)-1.0)/2.0
--> 337 self.bw = golden_section(a, c, delta, gwr_func, self.tol,
338 self.max_iter, self.int_score,
339 self.verbose)
F:\anaconda\lib\site-packages\mgwr\search.py in golden_section(a, c, delta, function, tol, max_iter, int_score, verbose)
60 score_b = dict[b]
61 else:
---> 62 score_b = function(b)
63 dict[b] = score_b
64 if verbose:
F:\anaconda\lib\site-packages\mgwr\sel_bw.py in (bw)
324
325 def _bw(self):
--> 326 gwr_func = lambda bw: getDiag[self.criterion](GWR(
327 self.coords, self.y, self.X_loc, bw, family=self.family, kernel=
328 self.kernel, fixed=self.fixed, constant=self.constant, offset=self.
F:\anaconda\lib\site-packages\mgwr\gwr.py in fit(self, ini_params, tol, max_iter, solve, lite, pool)
333 rslt = map(self._local_fit, range(m)) #sequential
334
--> 335 rslt_list = list(zip(*rslt))
336 influ = np.array(rslt_list[0]).reshape(-1, 1)
337 resid = np.array(rslt_list[1]).reshape(-1, 1)
F:\anaconda\lib\site-packages\mgwr\gwr.py in _local_fit(self, i)
246 Local fitting at location i.
247 """
--> 248 wi = self._build_wi(i, self.bw).reshape(-1, 1) #local spatial weights
249
250 if isinstance(self.family, Gaussian):
F:\anaconda\lib\site-packages\mgwr\gwr.py in _build_wi(self, i, bw)
234
235 try:
--> 236 wi = Kernel(i, self.coords, bw, fixed=self.fixed,
237 function=self.kernel, points=self.points,
238 spherical=self.spherical).kernel
F:\anaconda\lib\site-packages\mgwr\kernels.py in init(self, i, data, bw, fixed, function, eps, ids, points, spherical)
54 self.bandwidth = float(bw)
55 else:
---> 56 self.bandwidth = np.partition(
57 self.dvec,
58 int(bw) - 1)[int(bw) - 1] * eps #partial sort in O(n) Time
<array_function internals> in partition(*args, **kwargs)
F:\anaconda\lib\site-packages\numpy\core\fromnumeric.py in partition(a, kth, axis, kind, order)
746 else:
747 a = asanyarray(a).copy(order="K")
--> 748 a.partition(kth, axis=axis, kind=kind, order=order)
749 return a
750
ValueError: kth(=62) out of bounds (30)
The text was updated successfully, but these errors were encountered: