-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathdemo.m
41 lines (27 loc) · 981 Bytes
/
demo.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
% demo.m
close all;
clear;
clc;
%% load dataset
load('./dataset/AR_Face_img_60x43.mat');
%% Set option
options.verbose = true;
% %% reduce dataset for a quick test if necessary
% max_class_num = 10;
% max_train_samples = 2;
% max_test_samples = 15;
% [TrainSet, TestSet, train_num, test_num, class_num] = reduce_dataset(TrainSet, TestSet, max_class_num, max_train_samples, max_test_samples);
%
%
%
% %% normalize dataset if necessary
% [TrainSet.X, TrainSet.y] = data_normalization(TrainSet.X, TrainSet.y, 'std');
% [TestSet.X, TestSet.y] = data_normalization(TestSet.X, TestSet.y, 'std');
%% execute LSR
[accuracy_lsr, ~, ~] = lsr(TrainSet, TestSet, train_num, test_num, class_num, 0.001, options);
%% execute LRC
accuracy_lrc = lrc(TrainSet, TestSet, test_num, class_num, options);
%% display accuracy
fprintf('\n\n## Summary of results\n\n')
fprintf('# LSR: Accuracy = %5.5f\n', accuracy_lsr);
fprintf('# LRC: Accuracy = %5.5f\n', accuracy_lrc);