forked from tiepvupsu/DICTOL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FDDL_top.m
41 lines (40 loc) · 1.2 KB
/
FDDL_top.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 best_acc = FDDL_top(dataset, N_train, k, lambda1, lambda2)
% function FDDL_top(dataset, N_train, k, lambda1, lambda2)
%% Dependencies
addpath('utils');
addpath('LRSDL_FDDL');
addpath('ODL');
%% test mode
if nargin == 0
dataset = 'myARgender';
N_train = 350;
k = 25;
dataset = 'myYaleB';
N_train = 10;
k = 8;
k0 = 5;
lambda1 = 0.001;
lambda2 = 0.05;
end
%% get data
t = getTimeStr();
[dataset, Y_train, Y_test, label_train, label_test] = train_test_split(...
dataset, N_train);
%% main
[acc, rt] = FDDL_wrapper(Y_train, label_train, Y_test , label_test, ...
k, lambda1, lambda2)
fprintf('rt = %5.1f\n', rt);
%% output filename
if ~exist('results', 'dir')
mkdir('results');
end
if ~exist(fullfile('results', 'FDDL'), 'dir')
mkdir('results', 'FDDL');
end
fn = fullfile('results', 'FDDL', strcat(dataset, ...
'_N_', num2str(N_train), '_k_', num2str(k),'_l1_', ...
num2str(lambda1), '_l2_', num2str(lambda2),'_', t, '.mat'));
disp(fn);
save(fn, 'acc', 'rt');
best_acc = max(acc);
end