本文整理匯總了Python中scipy.stats.variation方法的典型用法代碼示例。如果您正苦於以下問題:Python stats.variation方法的具體用法?Python stats.variation怎麽用?Python stats.variation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類scipy.stats
的用法示例。
在下文中一共展示了stats.variation方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_variation
# 需要導入模塊: from scipy import stats [as 別名]
# 或者: from scipy.stats import variation [as 別名]
def test_variation(self):
#variation = samplestd/mean
## y = stats.variation(self.shoes[0])
## assert_almost_equal(y,21.8770668)
y = mstats.variation(self.testcase)
assert_almost_equal(y,0.44721359549996, 10)
示例2: test_variation
# 需要導入模塊: from scipy import stats [as 別名]
# 或者: from scipy.stats import variation [as 別名]
def test_variation(self):
# variation = samplestd / mean
y = stats.variation(self.testcase)
assert_approx_equal(y,0.44721359549996, 10)
示例3: test_variation
# 需要導入模塊: from scipy import stats [as 別名]
# 或者: from scipy.stats import variation [as 別名]
def test_variation(self):
y = mstats.variation(self.testcase)
assert_almost_equal(y,0.44721359549996, 10)
示例4: test_variation
# 需要導入模塊: from scipy import stats [as 別名]
# 或者: from scipy.stats import variation [as 別名]
def test_variation(self):
# variation = samplestd / mean
y = stats.variation(self.scalar_testcase)
assert_approx_equal(y, 0.0)
y = stats.variation(self.testcase)
assert_approx_equal(y, 0.44721359549996, 10)
x = np.arange(10.)
x[9] = np.nan
assert_equal(stats.variation(x), np.nan)
assert_almost_equal(stats.variation(x, nan_policy='omit'),
0.6454972243679028)
assert_raises(ValueError, stats.variation, x, nan_policy='raise')
assert_raises(ValueError, stats.variation, x, nan_policy='foobar')
示例5: test_variation_propagate_nan
# 需要導入模塊: from scipy import stats [as 別名]
# 或者: from scipy.stats import variation [as 別名]
def test_variation_propagate_nan(self):
# Check that the shape of the result is the same for inputs
# with and without nans, cf gh-5817
a = np.arange(8).reshape(2, -1).astype(float)
a[1, 0] = np.nan
vv = stats.variation(a, axis=1, nan_policy="propagate")
np.testing.assert_allclose(vv, [0.7453559924999299, np.nan], atol=1e-15)
示例6: all_features
# 需要導入模塊: from scipy import stats [as 別名]
# 或者: from scipy.stats import variation [as 別名]
def all_features():
""" Returns dictionary of all features in the module
.. note:: Some of the features (hist4, corr) are relatively expensive to compute
"""
features = {'mean': mean,
'median': median,
'gmean': gmean,
'hmean': hmean,
'vec_sum': vec_sum,
'abs_sum': abs_sum,
'abs_energy': abs_energy,
'std': std,
'var': var,
'mad': median_absolute_deviation,
'variation': variation,
'min': minimum,
'max': maximum,
'skew': skew,
'kurt': kurt,
'mean_diff': mean_diff,
'mean_abs_diff': means_abs_diff,
'mse': mse,
'mnx': mean_crossings,
'hist4': hist(),
'corr': corr2,
'mean_abs_value': mean_abs,
'zero_crossings': zero_crossing(),
'slope_sign_changes': slope_sign_changes(),
'waveform_length': waveform_length,
'emg_var': emg_var,
'root_mean_square': root_mean_square,
'willison_amplitude': willison_amplitude()}
return features
示例7: variation
# 需要導入模塊: from scipy import stats [as 別名]
# 或者: from scipy.stats import variation [as 別名]
def variation(X):
""" coefficient of variation """
return stats.variation(X, axis=1)