maxtargetalignment.m

来自「a function inside machine learning」· M 代码 · 共 18 行

M
18
字号
function u = maxTargetAlignment(X, y)
%A function to compute the maximum 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 emperical target alignment between X and Y 

a = 0.02*norm(X'*X); 
Ia = eye(size(X, 2)) * a;  
XXinv = inv(X'*X + Ia);
%XXinv = pinv(X'*X); 

u = XXinv*X'*y/sqrt(y'*X*XXinv*X'*y); 

⌨️ 快捷键说明

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