-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaptValiBestPerformer.m
More file actions
60 lines (51 loc) · 1.76 KB
/
aptValiBestPerformer.m
File metadata and controls
60 lines (51 loc) · 1.76 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
function aptValiBestPerformer(Nbest)
global apt
if ~isfield(apt,'vali')
error('this function requires some input sequences that will be mimicked.')
end
if ~exist('Nbest','var') || isempty(Nbest)
Nbest = 20;
end
fID = fopen('Predicted_Best_Performer.txt','w+');
for iY = 1:length(apt.Y)
fprintf(fID,'%50s',sprintf('Top %d performer for observable %s \n',Nbest,apt.data(1).obsName{iY}));
header;
[maxVal, maxIdx]= maxk(apt.vali.estResponse{iY},Nbest);
for i = 1:length(maxVal)
fprintf(fID,'%50s',apt.vali.generatedSequence{maxIdx(i)});
if isfield(apt.vali,'generatedSpacer')
fprintf(fID,'\t%50s',apt.vali.generatedSpacer{maxIdx(i)});
end
for iObs = 1:length(apt.data(1).obsName)
fprintf(fID,'\t');
fprintf(fID,sprintf('%f',apt.vali.estResponse{iObs}(maxIdx(i))));
end
fprintf(fID,'\n');
end
end
if length(apt.Y)>1
fprintf(fID,'%50s',sprintf('Top %d performer for sum of observables \n',Nbest));
header
totalresponse = apt.vali.estResponse{1};
for iN = 2:length(apt.vali.estResponse)
totalresponse = totalresponse + apt.vali.estResponse{iN};
end
[~, maxIdx]= maxk(totalresponse,Nbest);
for i = 1:length(maxVal)
fprintf(fID,'%50s',apt.vali.generatedSequence{maxIdx(i)});
for iObs = 1:length(apt.data(1).obsName)
fprintf(fID,'\t');
fprintf(fID,sprintf('%f',apt.vali.estResponse{iObs}(maxIdx(i))));
end
fprintf(fID,'\n');
end
end
function header
fprintf(fID,'%50s','Sequence');
for iObs = 1:length(apt.data(1).obsName)
fprintf(fID,apt.data(1).obsName{iObs});
fprintf(fID,'\t');
end
fprintf(fID,'\n');
end
end