-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRunAlgorithmHOSVD.m
More file actions
25 lines (22 loc) · 802 Bytes
/
RunAlgorithmHOSVD.m
File metadata and controls
25 lines (22 loc) · 802 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
25
function percentage = RunAlgorithmHOSVD(train, test, gt)
%TODO: optimize - lots of redundant operations
%input:
%train: train dataset
%test: test dataset
%gt: ground truth; indexes of the correct person
n_samples = size(test, 1);
A = prepareTensor3D(train);
[S, F, G, H] = HOSVD(A);
C = ten_mat_mult(ten_mat_mult(S, F, 1), G, 2);
count = 0;
for(i = 1:n_samples)
z = test(i, :)';
person = HOSVDmethod(C, H, z);
if(person == gt(i))
count = count + 1;
end
fprintf('Current percentage after iter %s is %s %% \n', num2str(i), num2str(count/i * 100));
end
percentage = count / n_samples;
fprintf('Final percentage of correct recognitions: %s %% \n', num2str(percentage * 100));
end