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

📄 som1.m

📁 模式识别工具包
💻 M
字号:
%	som1		- Online self-organizing map (1 iteration) %%	function [mamap,wmse]	= som1(data1,npara,nele,mamap,majump,mapos)%%	INPUTS%	======%	data1	: one data point				(col vector)%	npara	: see getnpara.m				(row vector)%	nele	: # elements in each map dimension		(col vector)%		  * limited to 1D and 2D%	mamap	: starting map vectors				(marray)%	majump	: radix for mamap				(col vector)%	mapos	: precomputed absolute pos of units		(col vectors)%%	OUTPUTS%	=======%	mamap	: ending map					(marray)%	wmse	: locally weighted MSE				(scalar)%%	* closed units not yet handled%%	(C) 2000.06.28 Kui-yu Chang%	http://lans.ece.utexas.edu/~kuiyu%	This program is free software; you can redistribute it and/or modify%	it under the terms of the GNU General Public License as published by%	the Free Software Foundation; either version 2 of the License, or%	(at your option) any later version.%%	This program is distributed in the hope that it will be useful,%	but WITHOUT ANY WARRANTY; without even the implied warranty of%	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the%	GNU General Public License for more details.%%	You should have received a copy of the GNU General Public License%	along with this program; if not, write to the Free Software%	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA%	or check%			http://www.gnu.org/function [mamap,wmse]	= som1(data1,npara,nele,mamap,majump,mapos)getnpara;[d,dum]	= size(data1);[dk,nk]	= size(mapos);%----------	find winner(nearest) unitrdata1	= data1*ones(1,prod(nele));	% replicatemadist2	= vdist2(rdata1,mamap);		% dist of all units to data1minabs	= min(find(madist2==min(madist2)));	% abs index of nearest unitminpos	= ma2pos(minabs,nele);		% position  of nearest unit%----------	find weights for neighbours of winner unitpdist2	= vdist2(minpos*ones(1,prod(nele)),mapos);	% in map spaceif clos	pdist2	= min([pdist2;clos-pdist2]);endfacpower= pdist2/((width*fdist)^2);fac	= exp(-facpower);		% row vector%----------	update all units toward data by factor of fac and mumamap	= mamap + mu*(ones(d,1)*fac).*(rdata1-mamap);%==========	compute average distortion of newly found map%----------	find winner(nearest) unitrdata1	= data1*ones(1,prod(nele));	% replicatemadist2	= vdist2(rdata1,mamap);		% dist of all units to data1minabs	= find(madist2==min(madist2));	% abs index of nearest unitminpos	= ma2pos(minabs,nele);		% position  of nearest unit%----------	find weights for neighbours of winner unitpdist2	= vdist2(minpos*ones(1,prod(nele)),mapos);facpower= pdist2/(2*(width*fdist)^2);fac	= exp(-facpower);		% row vector%----------	compute weighted msewmse	= mean(madist2.*fac);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -