source: distools/parzend_map.m @ 85

Last change on this file since 85 was 18, checked in by bduin, 13 years ago

clevald, parzenddc, parzend_map and kem added

File size: 978 bytes
Line 
1%PARZEN_MAP Map a dissimilarity dataset on a Parzen densities based classifier
2%
3%       F = PARZEN_MAP(D,W)
4%
5% INPUT
6%   D   Dissimilarity dataset
7%   W   Trained Parzen dissimilarity classifier mapping
8%
9% OUTPUT
10%   F   Mapped dataset
11%
12% DESCRIPTION
13%
14% SEE ALSO
15% MAPPINGS, DATASETS, PARZENDDC
16
17% Copyright: R.P.W. Duin, r.p.w.duin@prtools.org
18% Faculty EWI, Delft University of Technology
19% P.O. Box 5031, 2600 GA Delft, The Netherlands
20
21function f = parzend_map(d,w)
22        prtrace(mfilename);
23
24        % If no mapping is supplied, train one.
25        if (nargin < 2)
26                w = parzenddc(d);
27        end
28
29        pars = getdata(w);
30        I = getdata(w,'objects');
31        p = getdata(w,'prior');
32        nlab = getdata(w,'nlab');
33        h = getdata(w,'smoothpar');
34        q = getdata(w,'weights');
35        [k,c] = getsize(w);
36        [m,k] = size(d);
37        e = +d(:,I);
38       
39        f = zeros(m,c);
40        for j=1:c
41                J = find(nlab==j);
42                f(:,j) = p(j)*mean(repmat(q(J)',m,1).*exp(-(e(:,J).^2)./repmat((2.*h(J).*h(J))',m,1)),2);
43        end
44       
45        f = setdata(d,f,getlabels(w));
46       
47return
Note: See TracBrowser for help on using the repository browser.