📄 rbfpreimg3.html
字号:
<html><head> <meta HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=ISO-8859-1"> <title>rbfpreimg3.m</title><link rel="stylesheet" type="text/css" href="../../../m-syntax.css"></head><body><code><span class=defun_kw>function</span> <span class=defun_out>x </span>= <span class=defun_name>rbfpreimg3</span>(<span class=defun_in>model,nn</span>)<br><span class=h1>% RBFPREIMG3 RBF pre-image problem by Kwok-Tsang's algorithm.</span><br><span class=help>%</span><br><span class=help>% <span class=help_field>Synopsis:</span></span><br><span class=help>% x = rbfpreimg3(model)</span><br><span class=help>% x = rbfpreimg3(model,nn)</span><br><span class=help>%</span><br><span class=help>% <span class=help_field>Description:</span></span><br><span class=help>% x = rbfpreimg3(model) is an implementation of the algorithm </span><br><span class=help>% by [Kwok03] to solve the pre-image problem for kernel expansion </span><br><span class=help>% with RBF kernel. The kernel expansion is given in the input </span><br><span class=help>% structure model.</span><br><span class=help>%</span><br><span class=help>% x = rbfpreimg3(model,nn) use to set number of nearest </span><br><span class=help>% neighbours (default 10).</span><br><span class=help>%</span><br><span class=help>% <span class=help_field>Input:</span></span><br><span class=help>% model [struct] RBF kernel expansion:</span><br><span class=help>% .Alpha [nsv x 1] Weights.</span><br><span class=help>% .sv.X [dim x nsv] Vectors.</span><br><span class=help>% .options.arg [1x1] RBF kernel width.</span><br><span class=help>%</span><br><span class=help>% nn [1x1] Number of nearest neighbours.</span><br><span class=help>% </span><br><span class=help>% <span class=help_field>Output:</span></span><br><span class=help>% x [dim x 1] Pre-image of the RBF kernel expansion.</span><br><span class=help>% </span><br><span class=help>% See also </span><br><span class=help>% RBFPREIMG1, RBFPREIMG2, RSRBF, KPCAREC.</span><br><span class=help>%</span><br><hr><span class=help1>% <span class=help1_field>About:</span> Statistical Pattern Recognition Toolbox</span><br><span class=help1>% (C) 1999-2003, Written by Vojtech Franc and Vaclav Hlavac</span><br><span class=help1>% <a href="http://www.cvut.cz">Czech Technical University Prague</a></span><br><span class=help1>% <a href="http://www.feld.cvut.cz">Faculty of Electrical Engineering</a></span><br><span class=help1>% <a href="http://cmp.felk.cvut.cz">Center for Machine Perception</a></span><br><br><span class=help1>% <span class=help1_field>Modifications:</span></span><br><span class=help1>% 17-may-2004, VF</span><br><span class=help1>% 21-Feb-2004, VF</span><br><span class=help1>% 17-February-2004, Petr Posik</span><br><br><hr>[dim, num_data] = size(model.sv.X);<br><br><span class=comment>% default number of used nearest neighbours </span><br><span class=keyword>if</span> <span class=stack>nargin</span> < 2, nn = min([num_data, 10]); <span class=keyword>end</span><br><br>K = kernel(model.sv.X, <span class=quotes>'rbf'</span>, model.options.arg );<br><br>Const2 = model.Alpha(:)'*K*model.Alpha(:);<br>df2 = 1 + Const2 - 2*K*model.Alpha(:);<br>d2 = -2*model.options.arg^2 * log( 1 - 0.5*df2);<br><br><span class=comment>% select nn neighbours</span><br>[dummy, inx] = sort( df2 );<br>X = model.sv.X(:,inx(1:nn));<br>df2 = df2(inx(1:nn));<br>d2 = d2(inx(1:nn));<br><br>H = eye(nn,nn) - 1/nn * ones(nn,nn);<br><br>[U,L,V] = svd(X*H);<br>r = rank(L);<br><br>Z = L*V';<br><br>d02 = sum(Z.^2)';<br><br>z = -0.5*pinv(Z')*(d2-d02);<br>x = U*z + sum(X,2)/nn;<br><br><span class=jump>return</span>;<br><br></code>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -