⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pcademo1.m

📁 this a SVM toolbox,it is very useful for someone who just learn SVM.In order to be undestood easily,
💻 M
字号:
% PCADEMO1 demo on use of standard PCA.

% Statistical Pattern Recognition Toolbox, Vojtech Franc, Vaclav Hlavac
% (c) Czech Technical University Prague, http://cmp.felk.cvut.cz
% Modifications:% 5-July-2001, V.Franc 
echo on;

% First, we load data from file and display them. Use 'creatset' to 
% interactively create your own data.
pause;  % press anykey
data=load('pcaexam1');
ppoints(data.X, data.I);

% Now, we compute orthonormal projection matrix and project the data.
pause;  % press anykey
[T, sumErr, eigv ] = spca( data.X, 2 );

Y=T*data.X;         % projection to a new space

% The second coordinate will be replaced by constant and then the data 
% will be projected back to the original space (reconstruction).
pause;  % press anykey

Y(2,:) = repmat( mean(Y(2,:)), 1 , sum(data.K));

Xrec = T' * Y;

% Finaly, we display recostructed data and the conections to the original ones.
pause;  % press anykey
hold on;
ppoints(Xrec, 2*data.I );  % display reconstructed data with another label.

for i = 1:sum(data.K),
   origP = data.X(:,i);
   recP = Xrec(:,i); 
   
   diff(i) = norm( origP-recP )^2;   % square reconstruction error
   
   plot([origP(1),recP(1)],[origP(2),recP(2)],'k');   % conection
echo off;
end

echo on;

mean(diff)     % mean value of squared lenghts of connection black lines
eigv(2)        % eigenvalue of the neglected eigenvector

echo off;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -