-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathanalyseOptOMPLambda.m
More file actions
63 lines (55 loc) · 2.06 KB
/
Copy pathanalyseOptOMPLambda.m
File metadata and controls
63 lines (55 loc) · 2.06 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
% analyse the classification performance for different dictionaries and
% sparse decomposition schemes
% report on appropriate values for further tuning
function analyseOptOMPLambda(dataSet)
% function analyseOptOMPLambda(dataSet,dictType,dictSize,sampleSize)
% dataSet = 'VOC2006'
% dictType = 'universal'
% dictSize = 1000;
% sampleSize = 100000;
rootDir = '/vol/vssp/diplecs/ash/Data/';
lambdaDir = '/lambda/';
lambdaPerfDir = '/lambdaPerf/';
% initialize matlab
cdir = pwd;
cd ~;
startup;
cd (cdir);
sparseDecomp = 'OMP';
modes = [3];
modeDs = [0];
modeLs = [0,1,2];
nModes = max(size(modes));
nModeDs = max(size(modeDs));
nModeLs = max(size(modeLs));
for iMode = 1 : nModes
for iModeD = 1 : nModeDs
for iModeL = 1 : nModeLs
% grid search value of lambda based on dictionary learning mode
mode = modes(iMode);
modeD = modeDs(iModeD);
modeL = modeLs(iModeL);
lambdas = [0.1,0.2,0.4,0.6,0.8,1.0];
nLambda = max(size(lambdas));
perfAP = zeros(nLambda,3);
perfAPFileName = [(rootDir),(dataSet),(lambdaPerfDir),'mode',num2str(mode),'modeD',num2str(modeD),'modeL',num2str(modeL),(sparseDecomp),'.avg'];
for iLambda = 1 : nLambda
lambda = lambdas(iLambda);
lambdaPerFileAvg = [(rootDir),(dataSet),(lambdaDir),'mode',num2str(mode),'modeD',num2str(modeD),'lambda',num2str(lambda),'modeL',num2str(modeL),(sparseDecomp),'.avg'];
try
perf = dlmread(lambdaPerFileAvg,',');
perfAPAvg = mean(perf(:,1));
perfAPStd = std(perf(:,1));
fprintf('%d\t%d\t%d\t%f\t%f\t%f\n',mode,modeD,modeL,lambda,perfAPAvg,perfAPStd);
perfAP(iLambda,1) = lambda;
perfAP(iLambda,2) = perfAPAvg;
perfAP(iLambda,3) = perfAPStd;
catch err
disp(err.identifier);
end
end
end
dlmwrite(perfAPFileName,perfAP,'delimiter',',');
end
end
end