?? kpca_matrix.m
字號:
function psi = kpca_matrix(sv,x,kernel);%KPCA_MATRIX calculates the kernel matrix.%% usage% psi = kpca_matrix(sv,x,kernel);%% input% sv list of column vectors from the input space% x list of column vectors from input space% kernel a chosen kernel, e.g. % {'gaussian',1} Gaussian kernel with width 1% {'polynomial',3,5} Polynomial kernel of degree 3% and with offset 5%% STH * 15AUG2001switch kernel{1} case 'polynomial' d = kernel{2}; theta = kernel{3}; psi = ((sv' * x) + theta).^d; case 'gaussian' % Gaussian RBF c = kernel{2}; dim = size(sv,2); T = size(x,2); psi = zeros(dim,T); for di=1:dim % fprintf('di=%d/%d \r',di,dim) diff = repmat(sv(:,di),[1 T]) - x; psi(di,:) = exp(-sum(diff.*diff,1)/c); end % fprintf('\n') clear diff di otherwise error('kpca_matrix: the chosen kernel is not known, type "type map"')end
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -