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

📄 gd_evalsolution.m

📁 一个Matlab写的关于图理论以及其在机器学习中应用的教学用GUI软件
💻 M
字号:
function [TestError,TrainError, not_classified,final]=GD_EvalSolution(y,output,Labeled)

num_classes=max(y);
num=length(y);

% compute final classification, final==0 corresponds to "not classified
% -> vertex is disconnected from labeled components
table = repmat(0:num_classes,num,1)';   
% augmentation is done to include a zero label which corresponds to not
% classified
augment = [zeros(num,1), output(:,1:num_classes)];
classmat = min( augment == repmat(max(augment(:,2:num_classes+1),[],2),1,num_classes+1), [ones(num,1),augment(:,2:num_classes+1)] ~=0)';
[r1,c2]=find(classmat==1); % finds the entries with the maximum of the ouput or a one at zero for not classified
[j2,mm,nn]=unique(c2);    % if more than one nonzero entry per column occurs we make it unique by the unique function
final = r1(mm)-1;   
TotalError = sum(final~=y);

TrainError = sum(final(Labeled)~=y(Labeled));
TestError= (TotalError-TrainError)/(num-length(Labeled));
TrainError = TrainError / length(Labeled);
not_classified = (sum(final==0) - sum(final(Labeled)==0))/(num-length(Labeled));
 

⌨️ 快捷键说明

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