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

📄 dualgeneralfeatures.m.svn-base

📁 a function inside machine learning
💻 SVN-BASE
字号:
function [newTrainX, newTestX, subspaceInfo] = dualGeneralFeatures(trainX, trainY, testX, params)
%Compute the dual general features, based on the General Feature Extraction Framework, 
%on a set of training examples and labels and compute corresponding examples 
%projected onto the directions specified by the featureDirection function. A test 
%matrix of examples can also be supplied for the subspace projection. 
%
% inputs
% trainK is an (l x k) kernel matrix of training data 
% trainY is (l x m) containing the corresponding output vectors
% testK is an (l x l2) kernel matrix between training and test examples 
% T gives the number of iterations to be performed
% featureDirection is a string specifying a function which computes a
%   projection direction on centered matrices trainX and trainY at each
%   iteration
% dualFeatures is a string specifying a function which computes a
%   matrix Z to compute the new features by K*Z; 
%
% outputs
% newTrainK is the new training kernel matrix
% newTrainK is the new test kernel matrix
% b is the matrix of dual feature directions as columns

if (nargin ~= 4)
    fprintf('%s\n', help(sprintf('%s', mfilename)));
    error('Incorrect number of inputs - see above usage instructions.');
end

trainData = data; 
trainData = addDataField(trainData, 'X', trainX, 'examples'); 
trainData = addDataField(trainData, 'Y', trainY, 'labels'); 

testData = data; 
testData= addDataField(testData, 'X', testX, 'examples'); 

[subspaceInfo, trainInfo] = dualGeneralFeaturesTrain(trainData, params);
[testInfo, projectionInfo] = dualGeneralFeaturesProject(trainData, testData, subspaceInfo, params);

trainData = clearAllFields(trainData); 
testData = clearAllFields(testData); 

newTrainX = getDataFieldValue(trainInfo.data, 'X'); 
newTestX = getDataFieldValue(testInfo.data, 'X'); 

trainInfo.data = clearAllFields(trainInfo.data); 
testInfo.data = clearAllFields(testInfo.data); 

⌨️ 快捷键说明

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