本文整理汇总了Python中scipy.stats.nanmean方法的典型用法代码示例。如果您正苦于以下问题:Python stats.nanmean方法的具体用法?Python stats.nanmean怎么用?Python stats.nanmean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scipy.stats
的用法示例。
在下文中一共展示了stats.nanmean方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_nanmean_none
# 需要导入模块: from scipy import stats [as 别名]
# 或者: from scipy.stats import nanmean [as 别名]
def test_nanmean_none(self):
# Check nanmean when no values are nan.
m = stats.nanmean(X)
assert_approx_equal(m, X[4])
示例2: test_nanmean_some
# 需要导入模块: from scipy import stats [as 别名]
# 或者: from scipy.stats import nanmean [as 别名]
def test_nanmean_some(self):
# Check nanmean when some values only are nan.
m = stats.nanmean(self.Xsome)
assert_approx_equal(m, 5.5)
示例3: test_nanmean_all
# 需要导入模块: from scipy import stats [as 别名]
# 或者: from scipy.stats import nanmean [as 别名]
def test_nanmean_all(self):
# Check nanmean when all values are nan.
olderr = np.seterr(all='ignore')
try:
m = stats.nanmean(self.Xall)
finally:
np.seterr(**olderr)
assert_(np.isnan(m))
示例4: nanmean
# 需要导入模块: from scipy import stats [as 别名]
# 或者: from scipy.stats import nanmean [as 别名]
def nanmean(a, axis):
# don't call nan_to_num in here, unless you check that
# occlusion_test.py still works after you do it!
result = nanmean_impl(a, axis=axis)
return result
示例5: filter_both_psi
# 需要导入模块: from scipy import stats [as 别名]
# 或者: from scipy.stats import nanmean [as 别名]
def filter_both_psi(panc_df, gtex_df, min_mean=.05, max_mean=.95):
panc_mean = stats.nanmean(panc_df.values, 0)
gtex_mean = stats.nanmean(gtex_df.values, 0)
mask = (panc_mean > min_mean) * (panc_mean < max_mean) * (gtex_mean > min_mean) * (gtex_mean < max_mean)
return panc_df.loc[:, mask], gtex_df.loc[:, mask]
示例6: load_train_fs
# 需要导入模块: from scipy import stats [as 别名]
# 或者: from scipy.stats import nanmean [as 别名]
def load_train_fs():
# In the validation process, the training data was randomly shuffled firstly.
# For the prediction process, there is no need to shuffle the dataset.
# Owing to out of memory problem, Gaussian process only use part of training data, the prediction of gaussian process
# may be a little different from the model,which the training data was shuffled.
train_fs = np.genfromtxt(open(dir + '/train_v2.csv','rb'), delimiter=',', skip_header=1)
col_mean = stats.nanmean(train_fs, axis=0)
inds = np.where(np.isnan(train_fs))
train_fs[inds] = np.take(col_mean, inds[1])
train_fs[np.isinf(train_fs)] = 0
return train_fs
# load test data
示例7: load_test_fs
# 需要导入模块: from scipy import stats [as 别名]
# 或者: from scipy.stats import nanmean [as 别名]
def load_test_fs():
test_fs = np.genfromtxt(open(dir + '/test_v2.csv','rb'), delimiter=',', skip_header = 1)
col_mean = stats.nanmean(test_fs, axis=0)
inds = np.where(np.isnan(test_fs))
test_fs[inds] = np.take(col_mean, inds[1])
test_fs[np.isinf(test_fs)] = 0
return test_fs
# extract features from test data