forked from Alexflex/HNNC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoutputsFromClasses.m
41 lines (36 loc) · 959 Bytes
/
outputsFromClasses.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
function outputs = outputsFromClasses(classes, numOutputUnits)
% Ôîðìèðóåò íàáîð âûõîäíûõ îáðàçöîâ èç ìàññèâà êëàññîâ ïðèíàäëåæíîñòè
%
% outputs = outputsFromClasses(classes, numOutputUnits)
%
% Arguments
% classes - âûõîäíîé âåêòîð ñåòè
% numOutputUnits - ðàçìåðíîñòü âåêòîðà âûõîäîâ
%
% outputs - êëàññ, ê êîòîðîìó ñåòü îòíåñëà äàííûé ýëåìåíò
%
% Example
% classes = [ 1;
% 2;
% 3;
% 1;
% 3];
% outputs = outputsFromClasses(classes, 3);
% outputs = [ 1 -1 -1;
% -1 1 -1;
% -1 -1 1;
% 1 -1 -1;
% -1 -1 1];
%
% See also
%
% Revisions
% Author: Vulfin Alex, Date: 17/11/2010
% Supervisor: Vulfin Alex, Date: 17/11/2010
% Author: (Next revision author), Date: (Next revision date)
sampleCount = length(classes);
outputs = -ones(sampleCount, numOutputUnits);
for k = 1:sampleCount
outputs(k, classes(k)) = 1;
end
end % of function