这是python中的代码
x = np.array( [ [1, 10, 4], [3, 2, 1], [5, 1, 0] ] , dtype = np.float128 );
x = zscore(x, axis = 0);
print x;
输出为
[[-1.2247449 1.40693 1.3728129]
[ 0.0 -0.57932412 -0.39223227]
[ 1.2247449 -0.82760589 -0.98058068]]
在matlab中,
xxx = [1 10 4 ; 3 2 1; 5 1 0]
zscore(xxx)
输出为
-1.0000 1.1488 1.1209
0 -0.4730 -0.3203
1.0000 -0.6757 -0.8006
为什么sciPy.stats.zscore和matlab zscore函数不同?
答案 0 :(得分:1)
Matlab的计算等同于使用ddof=1
的SciPy的计算。 SciPy默认为ddof=0
。