hotelling 转换没有给出预期的结果

hotteling transformation does not give desired result

我想将 HOTELLING TRANSFORMATION 应用于给定向量并进行自我练习,这就是我在 matlab 中编写以下代码的原因

function  [Y covariance_matrix]=hotteling_trasform(X)
% this function take  X1,X2,X3,,Xn as a matrix and  apply hottleing
%transformation  to get  new set of vectors y1, y2,..ym so that covariance
%matrix of matrix consiist by yi vectors are almost diagonal
%% determine size of  given matrix
[m n]=size(X);
%% compute  mean of  columns of given matrix
means=mean(X);
%% substract mean from given matrix
centered=X-repmat(means,m,1);
%% calculate covariance matrix
covariance=(centered'*centered)/(m-1);
%% Apply eigenvector  decomposition
[V,D]=eig(covariance);
%% determine dimension of V
[m1 n1]=size(V);

%% arrange  matrix so that eigenvectors are  as rows,create matrix with size n1 m1
A1=zeros(n1,m1);
for ii=1:n1
    A1(ii,:)=V(:,ii);
end
%% applying hoteling transformation 
Y=A1*centered; %% because centered matrix is original -means
%% calculate covariance matrix
covariance_matrix=cov(Y);

然后我已经根据给定的矩阵对其进行了测试

A

A =

     4     6    10
     3    10    13
    -2    -6    -8

和运行代码之后

[Y covariance_matrix]=hotteling_trasform(A);
covariance_matrix

covariance_matrix =

    8.9281   22.6780   31.6061
   22.6780   66.5189   89.1969
   31.6061   89.1969  120.8030

这肯定不是对角矩阵,有什么问题吗?提前致谢

当您处理 行向量 而不是 向量时,您需要在 eigenvalue/eigenvector-decomposiiton 中对其进行调整.您需要 Y=centered*V 而不是 Y=A1*centered。然后你会得到

covariance_matrix =

    0.0000   -0.0000    0.0000
   -0.0000    1.5644   -0.0000
    0.0000   -0.0000  207.1022

因此您将得到两个非零 分量 ,这是您仅从 3D-space 中的三个点所期望的。 (它们只能形成一个平面,不能形成一个体积。)