📄 galm.m
字号:
% load data set
load xl.txt
load cs.txt
% -------------------------------------------------------------------------
xl_Input = xl(:, 1:5)';
xl_Target = xl(:, 6)';
cs_Input = cs(:, 1:5)';
cs_Target = cs(:, 6)';
clear xl cs
% Normalize these data set for network training and simulation
[xl_Input_norm, ps] = mapminmax(xl_Input);
[xl_Target_norm, ts] = mapminmax(xl_Target);
cs_Input_norm = mapminmax('apply', cs_Input, ps);
% create a neural network to capture the relationship between the Input and
% the Target
hide = 3;
net = newff(minmax(xl_Input_norm), [3, 1], {'tansig' 'purelin'}, 'trainlm');
[chronom, Fval] = genetic_al(hide);
[Iw, Lw, b] = decode(chronom);
net.IW = Iw;
net.LW = Lw;
net.b = b;
net.trainParam.epochs = 100;
net.trainParam.goal = 5e-3;
net.trainParam.show = 5;
net = train(net, xl_Input_norm, xl_Target_norm);
cs_Output_norm = sim(net, cs_Input_norm);
cs_Output = mapminmax('reverse', cs_Output_norm, ts);
[m1, b1, r1] = postreg(cs_Output, cs_Target);
xl_Output_norm = sim(net, xl_Input_norm);
xl_Output = mapminmax('reverse', xl_Output_norm, ts);
figure
[m2, b2, r2] = postreg(xl_Output, xl_Target);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -