📄 disp_res.m
字号:
% Script file to display results for tree_ga
%
% Author Date Predecessor Modification
% ====== ==== =========== ============
% B.McKay M.Willis 29/5/95 From tree_ga.m
% B.McKay 7/8/95 disp_res.m Included Simplification
%
% Function Calls: n_simp2.m
% ==============
%
% Last Modification: 6/10/95
% =================
%
count=0;
% plot results
a=fit(max_fit_ind);
b=mean(fit);
c=sqrt(sum((y-y_p).^2)/num_data);
d=mean(str_len);
e=max(str_len);
f=min(str_len);
g=str_len(max_fit_ind);
if i==1,
FIT = a;
MEAN_FIT=b;
MEAN_LEN=d;
MAX_LEN=e;
else
FIT = [FIT; a ];
MEAN_FIT = [MEAN_FIT; b ];
MEAN_LEN=[MEAN_LEN; d];
MAX_LEN=[MAX_LEN; e];
end
axes(ax1);
hold off
plot(y,'r')
hold on
plot(y_p,'g')
xlabel('Time');
ylabel('Actual & Predicted Output');
legend('actual','predicted')
axes(ax2);
hold off
plot([1:presults:i]',FIT,'c');
hold on
plot([1:presults:i]',MEAN_FIT,'b');
xlabel('Generation number');
ylabel('Fitness');
legend('Max','Mean')
axes(ax3);
hold off
hist(str_len)
[bin_value,bin_num]=hist(str_len);
hold on
plot([snip_length snip_length],[0 max(bin_value')],'r')
plot(g,0,'g*')
xlabel('String Length');
ylabel('Number');
%plot([1:presults:i]',MAX_LEN,'g');
%hold on
%plot([1:presults:i]',MEAN_LEN,'c');
%Xlabel('Generation number');
%Ylabel('String Length');
%legend('Max','Mean')
% Simplify expression for screen presentation
if simp_disp==1,
x=(pop(max_fit_ind,:));
ns2time1=clock;
x=n_simp2(x);
ns2time2=clock;
ns2time=ns2time+etime(ns2time2,ns2time1);
simp_pop=x;
else
simp_pop=(pop(max_fit_ind,:));
end
set(text2,'string',simp_pop);
set(text7,'string',num2str(a));
set(text9,'string',num2str(c));
%
% End
%
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -