📄 class_decision.m
字号:
% Program for decision.
% Input is matrix n_class*n_patterns which is generated by NN.
%
% The decision: for each column find values of maximal and next maximal element.
% If their difference -'margin' is greater than treshold, decide index (row) of the element.
% Otherwise, decide 0 (i.e., "I cannot decide").
% Final result is COLUMN vector.
%
% N.B When treshold is 0, we decide EVERYTHING (that's why we have <treshold...)
%
% INPUTS:
%
% results - n_class*n_pattern matrix (output from NN)
% treshold - if margin is smaller than treshold, there is no decision, i.e. decision is 0
% Treshold is either >0, or =0 (this is "normal" decision);
% OUTPUTS:
%
% decisions column-vector of decided classes
%
% [decisions]=class_decision(results,treshold)
function [decisions]=class_decision(results,treshold)
[maxX,indeces,second_maxX,second_indeces]=second_max(results);
decisions(find(maxX-second_maxX<treshold))=0;
decided_positions=find(maxX-second_maxX>=treshold);
decisions(decided_positions)=indeces(decided_positions);
decisions=decisions'; %returns column vector
return;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -