⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fitness.m

📁 一个遗传算法编的程序,大家看看吧.有人说不能用,但我用的很好.
💻 M
字号:
function fitnessdegree = fitness(chronom)

[r, length] = size(chronom);
hide = fix(length / 7);

% load training data set
load xl.txt
% -------------------------------------------------------------------------
xl_Input = xl(:, 1:5)';
xl_Target = xl(:, 6)';
clear xl

% Normalize these data set for network training and simulation
[xl_Input_norm, ps] = mapminmax(xl_Input);
[xl_Target_norm, ts] = mapminmax(xl_Target);

% create a neural network to capture the relationship between the Input and
% the Target
net = newff(minmax(xl_Input_norm), [hide, 1], {'tansig' 'purelin'}, 'trainlm');
[Iw, Lw, b] = decode(chronom);
net.IW = Iw;
net.LW = Lw;
net.b = b;
xl_Output_norm = sim(net, xl_Input_norm);
fitnessdegree = sum((xl_Output_norm - xl_Target_norm).^2);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -