本文整理汇总了Python中scipy.stats.zscore方法的典型用法代码示例。如果您正苦于以下问题:Python stats.zscore方法的具体用法?Python stats.zscore怎么用?Python stats.zscore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在模块scipy.stats的用法示例。
在下文中一共展示了stats.zscore方法的24个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_zscore_axis
点赞 7
# 需要导入模块: from scipy import stats [as 别名]
# 或者: from scipy.stats import zscore [as 别名]
def test_zscore_axis(self):
# Test use of 'axis' keyword in zscore.
x = np.array([[0.0, 0.0, 1.0, 1.0],
[1.0, 1.0, 1.0, 2.0],
[2.0, 0.0, 2.0, 0.0]])
t1 = 1.0/np.sqrt(2.0/3)
t2 = np.sqrt(3.)/3
t3 = np.sqrt(2.)
z0 = stats.zscore(x, axis=0)
z1 = stats.zscore(x, axis=1)
z0_expected = [[-t1, -t3/2, -t3/2, 0.0],
[0.0, t3, -t3/2, t1],
[t1, -t3/2, t3, -t1]]
z1_expected = [[-1.0, -1.0, 1.0, 1.0],
[-t2, -t2, -t2, np.sqrt(3.)],
[1.0, -1.0, 1.0, -1.0]]
assert_array_almost_equal(z0, z0_expected)
assert_array_almost_equal(z1, z1_expected)
开发者ID:ktraunmueller,项目名称:Computable,代码行数:24,
示例2: get_external_state
点赞 6
# 需要导入模块: from scipy import stats [as 别名]
# 或者: from scipy.stats import zscore [as 别名]
def get_external_state(self):
# Use Hi-Low median as signal:
x = (
np.frombuffer(self.data.high.get(size=self.time_dim)) +
np.frombuffer(self.data.low.get(size=self.time_dim))
) / 2
# Differences along time dimension:
d_x = np.gradient(x, axis=0) * self.p.cwt_signal_scale
# Compute continuous wavelet transform using Ricker wavelet:
cwt_x = signal.cwt(d_x, signal.ricker, self.cwt_width).T
# Note: differences taken once again along channels axis,
# apply weighted scaling to normalize channels
norm_x = np.gradient(cwt_x, axis=-1)
norm_x = zscore(norm_x, axis=0) * self.p.state_ext_scale
#out_x = tanh(norm_x)
out_x = np.clip(norm_x, -10, 10)
return out_x[:, None, :]
开发者ID:Kismuz,项目名称:btgym,代码行数:23,
示例3: test_zscore
点赞 6
# 需要导入模块: from scipy import stats [as 别名]
# 或者: from scipy.stats import zscore [as 别名]
def test_zscore(self):
for n in self.get_n():
x, y, xm, ym = self.generate_xy_sample(n)
#reference solution
zx = (x - x.mean()) / x.std()
zy = (y - y.mean()) / y.std()
#validate stats
assert_allclose(stats.zscore(x), zx, rtol=1e-10)
assert_allclose(stats.zscore(y), zy, rtol=1e-10)
#compare stats and mstats
assert_allclose(stats.zscore(x), stats.mstats.zscore(xm[0:len(x)]),
rtol=1e-10)
assert_allclose(stats.zscore(y), stats.mstats.zscore(ym[0:len(y)]),
rtol=1e-10)
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:19,
示例4: efficient_corr
点赞 6
# 需要导入模块: from scipy import stats [as 别名]
# 或者: from scipy.stats import zscore [as 别名]
def efficient_corr(x, y):
"""
Computes correlation of matching columns in `x` and `y`
Parameters
----------
x, y : (N, M) array_like
Input data arrays
Returns
-------
corr : (M,) numpy.ndarray
Correlations of columns in `x` and `y`
"""
corr = np.sum(zscore(x, ddof=1) * zscore(y, ddof=1), axis=0) / (len(x) - 1)
return corr
开发者ID:rmarkello,项目名称:abagen,代码行数:20,
示例5: neural_sorting
点赞 6
# 需要导入模块: from scipy import stats [as 别名]
# 或者: from scipy.stats import zscore [as 别名]
def neural_sorting(self,i):
if i==0:
self.isort = np.argsort(self.u[:,int(self.PCedit.text())-1])
elif i==1:
self.isort = self.isort1
if i<2:
self.spF = gaussian_filter1d(self.sp[np.ix_(self.isort,self.tsort)].T,
np.minimum(8,np.maximum(1,int(self.sp.shape[0]*0.005))),
axis=1)
self.spF = self.spF.T
else:
self.spF = self.sp
self.spF = zscore(self.spF, axis=1)
self.spF = np.minimum(8, self.spF)
self.spF = np.maximum(-4, self.spF) + 4
self.spF /= 12
self.img.setImage(self.spF)
self.ROI_position()
开发者ID:MouseLand,项目名称:suite2p,代码行数:20,
示例6: ks_refine
点赞 6
# 需要导入模块: from scipy import stats [as 别名]
# 或者: from scipy.stats import zscore [as 别名]
def ks_refine(varr, seeds, sig=0.05):
print("selecting seeds