plotfeaturevsindex.m

来自「一个关于数据聚类和模式识别的程序,在生物化学,化学中因该都可以用到.希望对大家有」· M 代码 · 共 38 行

M
38
字号
function out = plotFeatureVsIndex(DS)
%plotFeatureVsIndex: Plot of feature vs. data index

%	Roger Jang, 20041209

if nargin == 0, selfdemo; return, end

[featureNum, dataNum]=size(DS.input);
distinctClass = elementCount(DS.output);
classNum = length(distinctClass);
plotNum = featureNum;
side = ceil(sqrt(plotNum));
k = 1;
for i = 1:side,
	for j = 1:side,
		if k <= plotNum,
			subplot(side, side, k);
			for p=1:classNum
				index=find(DS.output==distinctClass(p));
				line(index, DS.input(k,index), 'marker', '.', 'lineStyle', 'none', 'color', getColor(p));
			end
			box on; axis([-inf inf -inf inf]);
			xlabel('Data index');
			if isfield(DS, 'inputName')
				ylabel(['x', num2str(k), ': ', DS.inputName{k}]);
			else
				ylabel(['x', num2str(k)]);
			end

			k = k+1;
		end
	end
end

% ====== Self demo
function selfdemo
DS=prData('iris');
feval(mfilename, DS);

⌨️ 快捷键说明

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