primalgeneralfeaturestest.m.svn-base

来自「a function inside machine learning」· SVN-BASE 代码 · 共 25 行

SVN-BASE
25
字号
%A script to test some properties of primalGeneralFeatures 

tol = 10^-6; 
numExamples =10; 
numFeatures = 5; 
numLabels = 2; 

X = rand(numExamples, numFeatures); 
Y = rand(numExamples, numLabels); 

T = 5; 
featureDirection = 'maxCovariance'; 

[newTrainX, newTestX, u, p] = primalGeneralFeatures(X, Y, X, T, featureDirection); 

%First, check that the training features are orthgonal 
if norm(newTrainX'*newTrainX - eye(T).*diag(sum(newTrainX.^2, 1))) > tol 
    error('Training features are not orthogonal'); 
end 

%Check X = TP' 
if norm(newTrainX*p' - X) > tol 
    error('Full rank TP does not return original features'); 
end 

⌨️ 快捷键说明

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