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

📄 bayclass.m

📁 细胞生长结构可视化工具箱-MATLAB Toolbox1999.zip
💻 M
字号:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     Calculate the performance as a classifier
tp=0;	%No True positives 
tn=0; 	%true negatives
fp=0;	% false positives
fn=0;	% false negatives

Act=[];
neg=[];
pos=[];
pippos=[];
pipneg=[];
class=[];


% Classify each test sample using parzen windows
for i=1:size(test,1)
	Ip = test(rem(i-1,size(test,1))+1,1:n);	
	class(i) =  test(rem(i-1,size(test,1))+1,n+1);
	for k = 1:size(wvis,1)
		Act(k) = exp(-((norm((Ip-w(k,:)),metric)^2)./(sigmav(k)).^2));
	end
	neg(i) = Act*z1;
	pos(i) = Act*z2;	
	pipneg(i) = neg(i)/(neg(i)+pos(i));
	pippos(i) = pos(i)/(neg(i)+pos(i));

	if (pippos(i)>pipneg(i))
		if (class(i) == 1)
			tp = tp+1;	% z2 is positive count
		else
			fp = fp+1;
		end
	else
		if (class(i) == 0)
			tn = tn+1;
		else
			fn = fn+1;
		end
	end
end




acc = (tp+tn)/(tp+tn+fp+fn);
sens = tp/(tp+fn);
spec = tn/(tn+fp);


disp('Performance of Bayes Classifier');
disp(['True Positives  ',int2str(tp)]);
disp(['True Negatives  ',int2str(tn)]);
disp(['False Positives ',int2str(fp)]);
disp(['False Negatives ',int2str(fn)]);
disp(['Accuracy        ',num2str(acc)]);
disp(['Sensitivity     ',num2str(sens)]);
disp(['Specificity     ',num2str(spec)]);

⌨️ 快捷键说明

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