-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodelSelectionFileOutput.m
More file actions
59 lines (50 loc) · 1.56 KB
/
modelSelectionFileOutput.m
File metadata and controls
59 lines (50 loc) · 1.56 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
% ************************************************************************
% Function: modelSelectionFileOutput
% Purpose: Generate a model selection plot from file
%
%
% Parameters:
% data
% options
% hyperparameters
%
% Output:
% bestHP: optimal hyperparameter values
%
% ************************************************************************
function modelSelectionFileOutput( traces, options )
opt = options.optimize;
optPlot = options.plot.sub;
v = opt.activeVar;
nVar = length( v );
result.grp = strings( nVar, 1 );
result.var = strings( nVar, 1 );
result.range = cell( nVar, 1 );
result.descr = strings( nVar, 1 );
result.lim = cell( nVar, 1 );
result.isLog = false( nVar, 1 );
result.nLevels = zeros( nVar, 1 );
for i = 1:nVar
result.grp(i) = opt.grp( v(i) );
result.var(i) = opt.var( v(i) );
result.descr(i) = opt.descr( v(i) );
result.lim(i) = opt.lim( v(i) );
result.isLog(i) = opt.isLog( v(i) );
result.varDef(i) = {opt.varDef( v(i) )};
switch opt.varDef( v(i) ).Type
case 'categorical'
result.range{i} = opt.varDef( v(i) ).Range;
case {'real', 'integer'}
result.range{i} = opt.varDef( v(i) ).Range(1): ...
opt.varDef( v(i) ).Range(2);
end
result.nLevels(i) = length( result.range{i} );
end
result.bestHP = traces(:, 1:end-1);
result.loss = traces(:, end);
modelSelectionPlot( result, 'initial' );
for i = 1:size(traces,1)
modelSelectionPlot( result, 'iteration', opt, optPlot );
end
modelSelectionPlot( result, 'done', opt, optPlot );
end