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

📄 post.m

📁 细胞生长结构可视化工具箱-MATLAB Toolbox1999.zip
💻 M
字号:
	% Apply Bayes theory to a GCS applied to an N-case problem
function GcsProj = post(GcsProj)
   
%UpdateStatus('Plotting Posteriors',[ 0 1 0 ]);
GcsProj.Gcs.Status = 'Plotting Posteriors';
GcsProj.Gcs.StatusColour = [0 1 0];
UpdateGUI;   

Gcs = GcsProj.Gcs;

if strcmp(Gcs.Trained,'Yes')
	if isempty(Gcs.cmap1)	% Must calculate frequency distributions first
		GcsProj = plotparw(GcsProj);   
	end
	
	extent;	%Calculate min and max values of x and y
	intbound = 0.1; % factor for determining interpolation boundary
	minxint = minx - intbound*(maxx-minx);
	maxxint = maxx + intbound*(maxx-minx);
	minyint = miny - intbound*(maxy-miny);
	maxyint = maxy + intbound*(maxy-miny);
	
	Noc = size(colormap,1);
	
	xi=minx:(maxx-minx)/Gcs.NoPts:maxx;
	yi=miny:(maxy-miny)/Gcs.NoPts:maxy;
	
	
	if isempty(Gcs.prcl1)	% Do not recalculate if already exists!
	
		% Calculate posteriors by normalising
		epsilon = 0.00000001;		%Small value to prevent divide by zero messages
      cmaptotal=zeros(size(Gcs.cmap1));
      if GcsProj.Gcs.EqualPriors		% Must adjust for priors !
         for cindex=1:Gcs.NoClasses		
            eval(['cmaptotal = cmaptotal + Gcs.cmap' int2str(cindex) '*Gcs.Prior' int2str(cindex) ';']);
			end
			for cindex=1:Gcs.NoClasses
				eval(['Gcs.prcl' int2str(cindex) ' = Gcs.cmap' int2str(cindex) '*Gcs.Prior' int2str(cindex) './(cmaptotal+epsilon);']);
         end
      else		% No Need to adjust for priors 
         for cindex=1:Gcs.NoClasses		
            eval(['cmaptotal = cmaptotal + Gcs.cmap' int2str(cindex) ';']);
			end
			for cindex=1:Gcs.NoClasses
				eval(['Gcs.prcl' int2str(cindex) ' = Gcs.cmap' int2str(cindex) './(cmaptotal+epsilon);']);
         end

      end
	end
	
	
	% Plot classes
	for cindex=1:Gcs.NoClasses
		figure;
		colormap(Gcs.c);
		cla;
	   eval(['imagesc(xi,yi,Gcs.prcl' int2str(cindex) ');']);
	   set(gca,'YDir','normal');
		colorbar;
      plotv2(Gcs);
      colormenu;
      if isempty(GcsProj.ClassLabels)
         title(['Posterior probability of class ' int2str(cindex)]);

      else
      	title(['Posterior probability of class ' GcsProj.ClassLabels(cindex,1:size(GcsProj.ClassLabels(cindex,:),2)-1) ]);   
      end
	   drawnow;
	end

	% Plot mesh
	figure;
	colormap(Gcs.c);
	clf;
	hold on;
	for cindex=1:Gcs.NoClasses
		eval(['mesh(xi,yi,Gcs.prcl' int2str(cindex) ');']);
	end
	axis([minx,maxx,miny,maxy,0,1]);
	view(45,30);
	title('Mesh of posteriors for all classes');
	if vers >= 5
		eval(['rotate3d on;']);
	end
	colormenu;
else
   uiwait(errordlg('Network Must be trained before visualisation plots are created!'));
end
GcsProj.Gcs = Gcs;	% Store calculated Posteriors in structure
SaveGcs(GcsProj.Gcs);% And save to file
%UpdateStatus('Idle','default');
GcsProj.Gcs.Status = 'Idle';
GcsProj.Gcs.StatusColour = 'default';
UpdateGUI;

⌨️ 快捷键说明

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