-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsummary.m
More file actions
61 lines (45 loc) · 1.55 KB
/
Copy pathsummary.m
File metadata and controls
61 lines (45 loc) · 1.55 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 summary(gp,plotlog)
%SUMMARY GPTIPS function to plot summary information from a GPTIPS run.
%
% Remarks:
% By default,log(fitness) is plotted rather than raw fitness when all
% best fitness history values are > 0.
% Use SUMMARY(GP,FALSE) to plot raw fitness values.
%
% (c) Dominic Searson 2009
%
% v1.0
%
% See also: RUNTREE, POPBROWSER
if nargin<1
disp('Usage is SUMMARY(GP) to plot log fitness vlaues or SUMMARY(GP,FALSE) to plot raw fitness values.');
return;
end
if nargin<2
plotlog=true;
end
if any(gp.results.history.bestfitness<=0)
plotlog=false;
end
h=figure;
set(h,'name',['GPTIPS summary of run with timestamp: ' gp.info.stop_time '. Fitness function: ' ...
func2str(gp.fitness.fitfun)],'numbertitle','off');
if plotlog
subplot(2,1,1);plot([0:1:gp.state.count-1],log(gp.results.history.runningbestfitness),'bx-');
ylabel('Log Fitness');
else
subplot(2,1,1);plot([0:1:gp.state.count-1],gp.results.history.runningbestfitness,'bx-');
ylabel('Fitness');
end
xlabel('Generation');
legend('Best fitness');
title(['Best fitness: ' num2str(gp.results.best.fitness) ' found at generation ' num2str(gp.results.best.foundatgen)]);
subplot(2,1,2);
hold on;
plot([0:1:gp.state.count-1],gp.results.history.meanfitness+gp.results.history.std_devfitness,'r:');hold on;
plot([0:1:gp.state.count-1],gp.results.history.meanfitness-gp.results.history.std_devfitness,'r:');
plot([0:1:gp.state.count-1],gp.results.history.meanfitness,'rx-');
legend('Mean fitness (+ - 1 std. dev)');
xlabel('Generation');
ylabel('Fitness');
hold off;