-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuo_nn_batch.m
39 lines (38 loc) · 1.56 KB
/
uo_nn_batch.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
% NN computational study
% Marcel, Mengxue
% OTDM-NN-Nov21
clear;
%
% Parameters.
%
tr_seed = 57052680; te_seed = 35520487;
tr_p = 250; te_q = 250; tr_freq = 0.5; % Datasets generation
epsG = 10^-6; kmax = 1000; % Stopping condition.
ils=3; ialmax = 1; kmaxBLS=10; epsal=10^-3; c1=0.01; c2=0.45; % Linesearch.
icg = 2; irc = 2 ; nu = 1.0; % Search direction.
sg_seed = 350415; sg_al0 = 2; sg_be = 0.3; sg_ga = 0.01; % SGM iteration.
sg_emax = kmax; sg_ebest = floor(0.01*sg_emax); % SGM stopping condition.
%
% Optimization
%
global iheader; iheader = 1;
csvfile = strcat('uo_nn_batch_',num2str(tr_seed),'-',num2str(te_seed),'.csv');
fileID = fopen(csvfile ,'w');
t1=clock;
for num_target = [1:10]
for la = [0.0, 0.01, 0.1]
for isd = [1,3,7]
[Xtr,ytr,wo,fo,tr_acc,Xte,yte,te_acc,niter,tex]=uo_nn_solve(num_target,tr_freq,tr_seed,tr_p,te_seed,te_q,la,epsG,kmax,ils,ialmax,kmaxBLS,epsal,c1,c2,isd,sg_al0,sg_be,sg_ga,sg_emax,sg_ebest,sg_seed,icg,irc,nu);
if iheader == 1
fprintf(fileID,'num_target; la; isd; niter; tex; tr_acc; te_acc; L*;\n');
end
fprintf(fileID,' %1i; %7.4f; %1i; %6i; %7.4f; %5.1f; %5.1f; %8.2e;\n', mod(num_target,10), la, isd, niter, tex, tr_acc, te_acc, fo);
iheader=0;
end
end
end
t2=clock;
total_t = etime(t2,t1);
fprintf(' wall time = %6.1d s.\n', total_t);
fclose(fileID);
uo_nn_batch_BP_log(tr_seed,te_seed,sg_seed, total_t, csvfile);