加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

[转]MATLAB中数据的标准化处理

(2012-04-13 12:43:04)
标签:

杂谈

分类: Matlab

源地址 http://blog.163.com/jianghuchuan@126/blog/static/46094821201102411517509/

数据的标准化处理是指:使得数据的期望为0,方差为1。

zscore
比如:
B =
                    6
             10    11    12
>> B_S=zscore(B)
B_S =
  Columns 1 through 4
   -0.7071   -0.7071   -0.7071   -0.7071
    0.7071    0.7071    0.7071    0.7071
  Columns 5 through 6
   -0.7071   -0.7071
    0.7071    0.7071
 
 
std(B)   %标准差(方差的正的平方根)
ans =
  Columns 1 through 4
    4.2426    4.2426    4.2426    4.2426
  Columns 5 through 6
    4.2426    4.2426
var(B)  %方差
ans =
    18    18    18    18    18    18
>> B
B =
                    6
             10    11    12
>> 4.2426*4.2426
ans =
   17.9997
 
若要求整个矩阵所有元素的均方差,则要使用std2函数:
B =
                    6
             10    11    12
>> std2(B)
ans =
    3.6056
ZSCORE Standardized z score.
    Z = ZSCORE(X) returns a centered, scaled version of X, the same size as X.
    For vector input X, Z is the vector of z-scores (X-MEAN(X)) ./ STD(X). For
    matrix X, z-scores are computed using the mean and standard deviation
    along each column of X.  For higher-dimensional arrays, z-scores are
    computed using the mean and standard deviation along the first
    non-singleton dimension.
 
    The columns of Z have sample mean zero and sample standard deviation one
    (unless a column of X is constant, in which case that column of Z is
    constant at 0).
 
    [Z,MU,SIGMA] = ZSCORE(X) also returns MEAN(X) in MU and STD(X) in SIGMA.
 
    [...] = ZSCORE(X,1) normalizes X using STD(X,1), i.e., by computing the
    standard deviation(s) using N rather than N-1, where N is the length of %这个很重要(无偏估计问题!!)
    the dimension along which ZSCORE works.  ZSCORE(X,0) is the same as
    ZSCORE(X).
 
    [...] = ZSCORE(X,FLAG,DIM) standardizes X by working along the dimension
    DIM of X. Pass in FLAG==0 to use the default normalization by N-1, or 1
    to use N.

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有