本文簡要介紹 python 語言中 scipy.cluster.vq.whiten
的用法。
用法:
scipy.cluster.vq.whiten(obs, check_finite=True)#
基於每個特征對一組觀察值進行歸一化。
在運行k-means之前,通過標準差重新調整觀察集的每個特征維度是有益的(即“whiten” it - 如在“white noise”中,每個頻率具有相等的功率)。每個特征除以其所有觀測值的標準差,得到單位方差。
- obs: ndarray
數組的每一行都是一個觀察值。列是每次觀察期間看到的特征。
>>> # f0 f1 f2 >>> obs = [[ 1., 1., 1.], #o0 ... [ 2., 2., 2.], #o1 ... [ 3., 3., 3.], #o2 ... [ 4., 4., 4.]] #o3
- check_finite: 布爾型,可選
是否檢查輸入矩陣是否僅包含有限數。禁用可能會提高性能,但如果輸入確實包含無窮大或 NaN,則可能會導致問題(崩潰、非終止)。默認值:真
- result: ndarray
包含按每列標準差縮放的 obs 值。
參數 ::
返回 ::
例子:
>>> import numpy as np >>> from scipy.cluster.vq import whiten >>> features = np.array([[1.9, 2.3, 1.7], ... [1.5, 2.5, 2.2], ... [0.8, 0.6, 1.7,]]) >>> whiten(features) array([[ 4.17944278, 2.69811351, 7.21248917], [ 3.29956009, 2.93273208, 9.33380951], [ 1.75976538, 0.7038557 , 7.21248917]])
相關用法
- Python SciPy vq.vq用法及代碼示例
- Python SciPy vq.kmeans用法及代碼示例
- Python SciPy vq.kmeans2用法及代碼示例
- Python SciPy interpolate.make_interp_spline用法及代碼示例
- Python SciPy stats.anderson用法及代碼示例
- Python SciPy ClusterNode.pre_order用法及代碼示例
- Python SciPy stats.iqr用法及代碼示例
- Python SciPy FortranFile.read_record用法及代碼示例
- Python SciPy ndimage.correlate用法及代碼示例
- Python SciPy special.exp1用法及代碼示例
- Python SciPy special.expn用法及代碼示例
- Python SciPy signal.czt_points用法及代碼示例
- Python SciPy interpolate.krogh_interpolate用法及代碼示例
- Python SciPy ndimage.morphological_gradient用法及代碼示例
- Python SciPy distance.sokalmichener用法及代碼示例
- Python SciPy linalg.eigvalsh_tridiagonal用法及代碼示例
- Python SciPy linalg.cdf2rdf用法及代碼示例
- Python SciPy csc_array.diagonal用法及代碼示例
- Python SciPy fft.idctn用法及代碼示例
- Python SciPy linalg.LaplacianNd用法及代碼示例
- Python SciPy linalg.solve_circulant用法及代碼示例
- Python SciPy hierarchy.ward用法及代碼示例
- Python SciPy signal.chirp用法及代碼示例
- Python SciPy stats.genpareto用法及代碼示例
- Python SciPy ndimage.variance用法及代碼示例
注:本文由純淨天空篩選整理自scipy.org大神的英文原創作品 scipy.cluster.vq.whiten。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。