?? hits.m
字號:
function [hits,ninvalid] = hits(bmus, mmax, values)%HITS Calculate number of occurances of each value.%% hits = hits(bmus,[mmax],[values])%% h = hits(bmus);% h = hits(bmus,length(sM.codebook)); %% Input and output arguments ([]'s are optional): % bmus (vector) BMU indeces (or other similar) % [mmax] (scalar) maximum index, default value max(bmus)% (struct) map or topology struct from where the maximum% index is acquired% [values] (vector) values associated with the data (default = 1)%% hits (vector) the number of occurances of each index% (or if values are given, their sum for each index)% ninvalid (scalar) number of invalid indeces (NaN, Inf or % <=0 or > mmax)%% See also SOM_HITS, SOM_BMUS. % Copyright (c) 2002 by the SOM toolbox programming team.% Contributed to SOM Toolbox by Juha Vesanto, April 24th, 2002% http://www.cis.hut.fi/projects/somtoolbox/% Version 2.0beta juuso 240402%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%if nargin<2 | isempty(mmax), mmax = max(bmus);elseif isstruct(mmax), switch mmax.type, case 'som_map', mmax = prod(mmax.topol.msize); case 'som_topol', mmax = prod(mmax.msize); otherwise, error('Illegal struct for 2nd argument.') endendif nargin<3, values = 1; endvalid_bmus = find(isfinite(bmus) & bmus>0 & bmus<=mmax); ninvalid = length(bmus)-length(valid_bmus); bmus = bmus(valid_bmus); if length(values)>length(bmus), values = values(valid_bmus); endhits = full(sum(sparse(bmus,1:length(bmus),values,mmax,length(bmus)),2));%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -