Matlab上Z归一化(z分数)函数的反函数 [英] Inverse of Z-Normalize (z-score) Function on Matlab

查看:287
本文介绍了Matlab上Z归一化(z分数)函数的反函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Matlab R2014a中,我有信心使用 zscore(x)函数

In Matlab R2014a I am confident of using zscore(x) function

function [z,mu,sigma] = zscore(x,flag,dim)
if isequal(x,[]), z = []; return; end

if nargin < 2
    flag = 0;
end
if nargin < 3
    % Figure out which dimension to work along.
    dim = find(size(x) ~= 1, 1);
    if isempty(dim), dim = 1; end
end

% Compute X's mean and sd, and standardize it
mu = mean(x,dim);
sigma = std(x,flag,dim);
sigma0 = sigma;
sigma0(sigma0==0) = 1;
z = bsxfun(@minus,x, mu);
z = bsxfun(@rdivide, z, sigma0); 

其中x是时间序列的数组(1x12的两倍).z的公式基本上是: z =(x-平均值)/stdDev 假设x最初设置为:

which x is an array (1x12 double) of a time series. The formula for z is basically: z = (x - mean)/stdDev lets say x is initially set to :

x =第1至5列>>40.466666670000002 43.538461540000000 40.466666670000002 41.846153850000000 46.266666669999999第6至10列>>68.000000000000000 87.200000000000003 42.933333330000004 41.071428570000002 41.428571429999998第 11 至 12 栏>>83.200000000000003 96.076923080000000

x = Columns 1 through 5>> 40.466666670000002 43.538461540000000 40.466666670000002 41.846153850000000 46.266666669999999 Columns 6 through 10>> 68.000000000000000 87.200000000000003 42.933333330000004 41.071428570000002 41.428571429999998 Columns 11 through 12>> 83.200000000000003 96.076923080000000

我跑步后

x=zscore(x);

它变成如下:

x =第1至5列>>-0.730346157143482 -0.586298957286754 -0.730346157143482 -0.665657180852154 -0.458363881462091第6至10列>>0.560788093923360 1.461143213420378 -0.614675534465169 -0.701986757521516 -0.685239080313558第11至12列>>1.273569230191833 1.877413168652630

x = Columns 1 through 5>> -0.730346157143482 -0.586298957286754 -0.730346157143482 -0.665657180852154 -0.458363881462091 Columns 6 through 10>> 0.560788093923360 1.461143213420378 -0.614675534465169 -0.701986757521516 -0.685239080313558 Columns 11 through 12>> 1.273569230191833 1.877413168652630

我需要应用其逆函数.我应该如何在Matlab上实现代码.

I need to apply its inverse function. How should I implement the code on Matlab.

推荐答案

要计算逆,您将需要知道原始x的均值和标准偏差,因为输入的值很多,可能导致相同的z分数.我认为您已经了解到,根据z分数的定义,z分数的均值和标准偏差分别始终为0和1,因此没有提供任何有用的信息.

To calculate the inverse you will need to know the mean and standard deviation of the original x, as there are there are many values of the input which can result in the same z scores. As I think you've realised the mean and standard deviaiton of the z-scores are always 0 and 1 respectively, by the definition of the z-score and so give no useful information.

如果您知道原始的均值和标准差.您可以简单地通过 x = std(x)* z + mean(x)计算原始x.但是,如果您不这样做,那么问题就没有得到很好的定义,也无法解决.

If you know the original mean and standard deviation. You can calculate the original x simply as x=std(x)*z+mean(x). However, if you don't then the problem is not well defined and can't be solved.

作为一个例子,如果您向所有原始数据加上100,则z得分不变.没有办法单独从z分数中区分出哪个x值正确.如果将原始数据乘以常数,则结果相同.

As an example of this if you add 100 to all your original data, the z-scores are unchanged. There is not way of distinguishing which x value is correct from the z-score alone. The same if you multiply the original data by a constant.

这篇关于Matlab上Z归一化(z分数)函数的反函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆