forked from tiepvupsu/DICTOL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DLSI_top.m
47 lines (46 loc) · 1.7 KB
/
DLSI_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
42
43
44
45
46
47
function best_acc = DLSI_top(dataset, N_train, k, lambda, eta)
% * function DLSI_top(dataset, N_train, k, lambda, eta)
% * The top function of DLSI
% * INPUT:
% + `dataset`: name of the dataset stored in `.mat` file in `data` folder.
% Note that `dataset` is the file name of the `.mat`, excluding `.mat`.
% + `N_train`: number of training samples in each class
% + `k`: number of atoms in EACH dictionary
% + `lambda, eta`: regularization parameters.
% * To run an small example, type `DLSI_top` without input in MATLAB command window.
% -----------------------------------------------
% Author: Tiep Vu, [email protected], 5/11/2016
% (http://www.personal.psu.edu/thv102/)
% -----------------------------------------------
addpath(genpath('utils'));
addpath(genpath('DLSI'));
addpath('ODL')
%% test mode
if nargin == 0
dataset = 'myYaleB';
N_train = 15;
k = 10;
lambda = 0.001;
eta = 0.01;
end
%%
t = getTimeStr();
[dataset, Y_train, Y_test, label_train, label_test] = train_test_split(...
dataset, N_train);
if ~exist('results', 'dir')
mkdir('results');
end
if ~exist(fullfile('results', 'DLSI'), 'dir')
mkdir('results', 'DLSI');
end
fn = fullfile('results', 'DLSI', strcat(dataset, '_N_', num2str(N_train), ...
'_k_', num2str(k), '_l_', num2str(lambda), '_e_', num2str(eta), '_', ...
t, '.mat'));
disp(fn);
[acc, rt] = DLSI_wrapper(Y_train, label_train, Y_test , label_test, ...
k, lambda, eta);
disp(acc);
disp(fn);
% save(fn, 'acc', 'rt');
best_acc = acc;
end