本文整理匯總了Python中scipy.stats.median_absolute_deviation方法的典型用法代碼示例。如果您正苦於以下問題:Python stats.median_absolute_deviation方法的具體用法?Python stats.median_absolute_deviation怎麽用?Python stats.median_absolute_deviation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類scipy.stats
的用法示例。
在下文中一共展示了stats.median_absolute_deviation方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: all_features
# 需要導入模塊: from scipy import stats [as 別名]
# 或者: from scipy.stats import median_absolute_deviation [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
示例2: mad_wavelet
# 需要導入模塊: from scipy import stats [as 別名]
# 或者: from scipy.stats import median_absolute_deviation [as 別名]
def mad_wavelet(image):
""" image: Median absolute deviation of the first wavelet scale.
(WARNING: sorry to disapoint, this is not a wavelet for mad scientists)
Parameters
----------
image: array
An image or cube of images
Returns
-------
mad: array
median absolute deviation for each image in the cube
"""
sigma = mad(Starlet(image, lvl = 2).coefficients[:,0,...], axis = (-2,-1))
return sigma
示例3: median_absolute_deviation
# 需要導入模塊: from scipy import stats [as 別名]
# 或者: from scipy.stats import median_absolute_deviation [as 別名]
def median_absolute_deviation(X):
""" median absolute deviation for each variable in a segmented time series """
return stats.median_absolute_deviation(X, axis=1)
示例4: test_mad
# 需要導入模塊: from scipy import stats [as 別名]
# 或者: from scipy.stats import median_absolute_deviation [as 別名]
def test_mad():
from scipy.stats import median_absolute_deviation
x = np.arange(50)
assert np.isclose(util.mad(x), median_absolute_deviation(x, scale=1))