當前位置: 首頁>>代碼示例>>Python>>正文


Python stats.nanmean方法代碼示例

本文整理匯總了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]) 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:6,代碼來源:test_stats.py

示例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) 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:6,代碼來源:test_stats.py

示例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)) 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:10,代碼來源:test_stats.py

示例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 
開發者ID:mattloper,項目名稱:opendr,代碼行數:7,代碼來源:common.py

示例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] 
開發者ID:ratschlab,項目名稱:pancanatlas_code_public,代碼行數:7,代碼來源:sf_heatmap.py

示例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 
開發者ID:freedomljc,項目名稱:Loan_Default_Prediction,代碼行數:16,代碼來源:predict.py

示例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 
開發者ID:freedomljc,項目名稱:Loan_Default_Prediction,代碼行數:11,代碼來源:predict.py


注:本文中的scipy.stats.nanmean方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。