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

📄 kpca_matrix.m

📁 核主成分分析KPCA算法源码[matlab]
💻 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 + -