git.schokokeks.org
Repositories
Help
Report an Issue
SVMCrossVal.git
Code
Commits
Branches
Tags
Suche
Strukturansicht:
4dbef18
Branches
Tags
master
SVMCrossVal.git
somtoolbox2
som_fillnans.m
starting som prediction fine-tuned class-performance visualisation
Christoph Budziszewski
commited
4dbef18
at 2009-01-21 16:34:25
som_fillnans.m
Blame
History
Raw
function sD = som_fillnans(sD,sM,bmus) % SOM_FILLNANS Replaces NaNs in the data matrix with values from % SOM prototypes. % % sD = som_fillnans(sD,sM, [bmus]) % % sD (struct) data struct % (matrix) size dlen x dim % sM (struct) data struct, with .data of size dlen x dim % (matrix) size dlen x dim, a matrix from which % the values are taken from directly % (struct) map struct: replacement values are taken from % sM.codebook(bmus,:) % [bmus] (vector) BMU for each data vector (calculated if not specified) % % See also SOM_MAKE. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% if isstruct(sD), [dlen dim] = size(sD.data); nans = find(isnan(sD.data)); else [dlen dim] = size(sD); nans = find(isnan(sD)); end if nargin<3, bmus = som_bmus(sM,sD); end if isstruct(sM) & strcmp(sM.type,'som_map'), sM = sM.codebook(bmus,:); elseif isstruct(sM), sM = sM.data(bmus,:); else sM = sM(bmus,:); end me = mean(sM); if any(size(sM) ~= [dlen dim]), error('Invalid input arguments.') end if isstruct(sD), sD.data(nans) = sM(nans); else sD(nans) = sM(nans); end return; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%