Diff of /run.m [000000] .. [d8e26d]

Switch to unified view

a b/run.m
1
clear;clc;
2
addpath(genpath('./MLFre/DPC'));
3
addpath(genpath('./SLEP_package_4.1'));
4
5
%% Generate the synthetic data
6
SyntheticDatagenerator();
7
8
9
%% ---------------------- load the tree----------------------
10
11
groupInfo = load('SyntheticData/index_tree.mat');
12
nameVec = [1,2,3,4,5,6,7,8];
13
14
%% ----------------------- Set optional items -----------------------
15
opts=[];
16
17
% Starting point
18
opts.init=1;        % 2: starting from a zero point
19
% 1: warm start
20
21
% Termination
22
opts.tFlag=5;       % run .maxIter iterations
23
opts.maxIter=1000;   % maximum number of iterations
24
25
% regularization
26
opts.rFlag=1;       % 1: use ratio
27
% 0: use the true value
28
% Normalization
29
opts.nFlag=0;       % without normalization
30
31
% Group Property
32
newInd = groupInfo.index_tree;
33
opts.ind = newInd;
34
35
%% ----------------- set the parameter values ------------------
36
ub = 1;
37
lb = 0.1;
38
npar = 100;
39
scale = 'log';
40
Lambda = get_lambda(lb, ub, npar, scale);
41
d = 4;  
42
43
44
45
%% --------------------- experiments ----------------
46
ntrial = 8;
47
nSubsample = 100;
48
run_solver = 0;
49
50
npar = length(Lambda);
51
rej_ratio = zeros(d,npar);
52
run_time = [];
53
fold = 2;
54
X_all  = [];
55
y_all  = [];
56
for trial = 1:ntrial
57
    fileName = sprintf('SyntheticData/SyntheticData%d.mat',nameVec(trial));
58
    data = load(fileName);
59
    Xs{trial} = data.norm_input;
60
    ys{trial} = data.norm_res;
61
end
62
clear('data');
63
64
Xsize = length(ys{1});
65
66
for idx_subsample = 1:nSubsample
67
    indices = crossvalind('Kfold', Xsize, fold);
68
    for idx_t = 1: length(ys)
69
        subXs{idx_t} = zscore(Xs{idx_t}(indices == 1, :));
70
        subys{idx_t} = zscore(ys{idx_t}(indices ==1));
71
    end
72
    %% STM with Screening Method HFS
73
    fprintf('training STM in %d-th sampling ...\n', idx_subsample);
74
    [Sol_STM_HFS{idx_subsample}] = STM_HFS(subXs, subys, Lambda, opts);
75
end
76
77
save('results.mat','Sol_STM_HFS');
78
79
80
81
82
83