本文整理汇总了Python中pysal.weights.spatial_lag.slag函数的典型用法代码示例。如果您正苦于以下问题:Python slag函数的具体用法?Python slag怎么用?Python slag使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了slag函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: calc
def calc(z,w,n,z2ss,start,stop):
pid=mp.current_process()._identity[0]
shared_sim = np.frombuffer(c_perm)
for i in range(start,start+stop):
r_num = np.random.RandomState(pid + i)
z = r_num.permutation(z)
zl = slag(w, z)
inum = sum(z * zl)
shared_sim[i] = n / w.s0 * inum / z2ss
示例2: __quads
def __quads(self):
zl = slag(self.w, self.z)
zp = self.z > 0
lp = zl > 0
pp = zp * lp
np = (1 - zp) * lp
nn = (1 - zp) * (1 - lp)
pn = zp * (1 - lp)
self.q = 1 * pp + 2 * np + 3 * nn + 4 * pn
示例3: __quads
def __quads(self):
zl = slag(self.w, self.z)
zp = self.z > 0
lp = zl > 0
pp = zp * lp
np = (1 - zp) * lp
nn = (1 - zp) * (1 - lp)
pn = zp * (1 - lp)
self.q = self.quads[0] * pp + self.quads[1] * np + self.quads[2] * nn + self.quads[3] * pn
示例4: quads
def quads(w,z):
zl = slag(w,z)
zp = z > 0
lp = zl > 0
pp = zp * lp
np = (1 - zp) * lp
nn = (1 - zp) * (1 - lp)
pn = zp * (1 - lp)
return 1 * pp + 2 * np + 3 * nn + 4 * pn
示例5: calc
def calc(self):
y = self.y
y2 = y * y
self.y_sum = y_sum = sum(y)
y2_sum = sum(y2)
if not self.star:
yl = 1.0 * slag(self.w, y)
ydi = y_sum - y
self.Gs = yl / ydi
N = self.n - 1
yl_mean = ydi / N
s2 = (y2_sum - y2) / N - (yl_mean) ** 2
else:
self.w.transform = 'B'
yl = 1.0 * slag(self.w, y)
yl += y
if self.w_transform == 'r':
yl = yl / (self.__getCardinalities() + 1.0)
self.Gs = yl / y_sum
N = self.n
yl_mean = y.mean()
s2 = y.var()
EGs_num, VGs_num = 1.0, 1.0
if self.w_transform == 'b':
W = self.__getCardinalities()
W += self.star
EGs_num = W * 1.0
VGs_num = (W * (1.0 * N - W)) / (1.0 * N - 1)
self.EGs = (EGs_num * 1.0) / N
self.VGs = (VGs_num) * (1.0 / (N ** 2)) * ((s2 * 1.0) / (yl_mean ** 2))
self.Zs = (self.Gs - self.EGs) / np.sqrt(self.VGs)
self.w.transform = self.w_original
示例6: calc
def calc(self, w, z):
zl = slag(w, z)
return self.n_1 * self.z * zl / self.den
示例7: __calc
def __calc(self, zy):
wzy = slag(self.w, zy)
self.num = sum(self.zx * wzy)
self.den = sum(zy * zy)
return self.num / self.den
示例8: calc
def calc(self, w, zx, zy):
zly = slag(w, zy)
return self.n_1 * self.zx * zly / self.den
示例9: __calc
def __calc(self, zy):
wzy = slag(self.w, zy)
self.num = (self.zx * wzy).sum()
self.den = (zy * zy).sum()
return self.num / self.den
示例10: _calc
def _calc(z,w,n,z2ss):
zl = slag(w, z)
inum = sum(z * zl)
return n / w.s0 * inum / z2ss
示例11: calc
def calc(w, z ,n_1, den):
zl = slag(w,z)
return n_1 * z * zl / den
示例12: __calc
def __calc(self, y):
yl = slag(self.w, y)
self.num = y * yl
return self.num.sum() / self.den_sum