-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestNetwork.m
More file actions
24 lines (20 loc) · 795 Bytes
/
Copy pathtestNetwork.m
File metadata and controls
24 lines (20 loc) · 795 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
%% Test the Network:
function numberOfCorrectedClassified = testNetwork(testSamples,testTargets, numberOfTestSamples, trainedNetworkWeightL1, trainedNetworkWeightL2)
correctedClassified = 0;
for i = 1 : numberOfTestSamples
OSample = testSamples(:,i); % getting test samples
OTarget = testTargets(:,i); % getting the target
NET1 = OSample'*trainedNetworkWeightL1;
NET1 = NET1';
OUT1 = 1./(1+exp(-NET1));
X2 = [1;OUT1];
NET2 = X2'*trainedNetworkWeightL2;
NET2 = NET2';
OUT2 = 1./(1+exp(-NET2)); % Output of the trained network
[V, Index] = max(OUT2); % getting the index of max value of output vector
if(OTarget(Index) == 1)
correctedClassified = correctedClassified + 1;
end
end
numberOfCorrectedClassified = correctedClassified;
end