当前位置: 首页>>代码示例>>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;未经允许,请勿转载。