perf6.m

来自「用VC++编写的遗传算法源程序」· M 代码 · 共 51 行

M
51
字号
function [pin]=perf6(coefs,x,y,s1,s2,s3);
%
% Calculates the performance index for all
% members of the population
%
% [out]=perf(coefs,x,y,s1,s2,s3);
%
% coefs = decoded parameters
% x     = x data
% y     = target y data
% s1    = size of input layer
% s2    = size of first hidden layer
% s3    = size of output layer
% pin   = matrix of performance indices
%

%
% establish the size of the population
%
[popsize L]=size(coefs);

%
% Go through each population member
%
for i = 1:popsize
	%
	% Extract the network from the coefficients
	%
	[w1 b1 w2 b2 f1 f2 f3]=exnet(coefs(i,:),s1,s2,s3);

	%
	% Filter the inputs
	%
	net=fil(x,f1);
	%
	% Propagate the inputs
	% SIGMOIDAL TRANSFER
	%
	net=prop1(net,w1,b1,2,f2);
	%
	% Propagate through to the ouput layer
	% LINEAR TRANSFER
	%
	net=prop1(net,w2,b2,1,f3);
	%
	% Evaluate the performance
	%
	pin(i)=sse(net,y);
end

⌨️ 快捷键说明

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