📄 maxsparsetargetalignment.m.svn-base
字号:
function u = maxSparseTargetAlignment(X, y)
%A function to compute the maximum sparse target alignment vector between matrix X
%and vector y
%
%inputs
%X data matrix with examples as rows
%y labels column vector
%
%outputs
%u the vector which maximises the sparse empirical target alignment between X and Y
%We just use the example with the highest kernel target alignment
numExamples = size(X, 1);
maxAlignment = -1;
Xy = X'*y;
varX = X'*X;
for i=1:numExamples
v = X(i, :)';
alignment = (v'*Xy)^2/(numExamples*(v'*varX*v));
if alignment > maxAlignment
maxAlignment = alignment;
u = v;
end
end
%u = u/norm(u);
u = u/sqrt(u'*varX*u);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -