?? demo.m
字號(hào):
function [v,b]=demo
%DEMO Demonstration function of the GPLAB toolbox.
% DEMO runs a symbolic regression problem (the quartic
% polynomial) with 100 individuals for 25 generations,
% with automatic adaptation of operator probabilities,
% drawing several plots in runtime, and finishing with
% two additional post-run plots.
%
% VARS=DEMO returns all the variables of the algorithm
% needed to plot charts, continue runs, draw trees, etc.
%
% [VARS,BEST]=DEMO also returns the best individual found
% during the run (the same as 'vars.state.bestsofar').
%
% See also DEMOPARITY,DEMOANT
%
% Copyright (C) 2003-2004 Sara Silva (sara@dei.uc.pt)
% This file is part of the GPLAB Toolbox
fprintf('Running symbolic regression demo...');
p=resetparams;
p=setoperators(p,'crossover',2,2,'mutation',1,1);
p.operatorprobstype='variable';
p.minprob=0;
p.datafilex='quartic_x.txt';
p.datafiley='quartic_y.txt';
p.usetestdata=1;
p.testdatafilex='exp_x.txt';
p.testdatafiley='exp_y.txt';
p.calcdiversity={'uniquegen'};
p.calccomplexity='1';
p.depthnodes='2';
[v,b]=gplab(25,50,p);
desired_obtained(v,[],1,0,[]);
accuracy_complexity(v,[],0,[]);
figure
plotpareto(v);
drawtree(b.tree);
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -