本文整理匯總了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