-
Notifications
You must be signed in to change notification settings - Fork 0
/
check.m
49 lines (33 loc) · 1020 Bytes
/
check.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
42
43
44
45
46
47
48
49
function output = check(finalB1L1, finalB1L2, finalW1L1, finalW1L2, finalSoftmaxTheta,data)
% load('NN.mat');
% load('testSet.mat');
%
% data = testData(:,x);
%data is 784 x 1
i = 0;
temp = 0;
%for i = 1:200
%loop demonstrating what we need to do
% temp = dot(finalW1L1(i,:), data);
% temp = temp + finalB1L1(i);
% secondLayer(i) = temp;
%end
secondLayer = finalW1L1*data;
%Mat mult of weights times data; size is 200x1
secondLayer = secondLayer + finalB1L1;
%adds the bias
secondLayer = 1./(1+exp(-secondLayer));
thirdLayer = finalW1L2*secondLayer;
%Mat mult of weights times second layer; size is 200x1;
thirdLayer = thirdLayer + finalB1L2;
thirdLayer = 1./(1+exp(-thirdLayer));
finalLayer = finalSoftmaxTheta*thirdLayer;
%is a 10x1 matrix of positive numbers
finalLayer = 1./(1+exp(-finalLayer));
finalLayer(1:10);
%now output index that is max of final layer
highest_prob = max(finalLayer);
output = find(finalLayer==highest_prob);
output;
%testLabels(x)
end