资源简介
代码解释的很详细,可以直接用,已经测试过了,很好用。
代码片段和文件信息
function Y = elmpredict(PIWBLWTFTYPE)
% ELMPREDICT Simulate a Extreme Learning Machine
% Syntax
% Y = elmtrain(PIWBLWTFTYPE)
% Description
% Input
% P - Input Matrix of Training Set (R*Q)
% IW - Input Weight Matrix (N*R)
% B - Bias Matrix (N*1)
% LW - layer Weight Matrix (N*S)
% TF - Transfer Function:
% ‘sig‘ for Sigmoidal function (default)
% ‘sin‘ for Sine function
% ‘hardlim‘ for Hardlim function
% TYPE - Regression (0default) or Classification (1)
% Output
% Y - Simulate Output Matrix (S*Q)
% Example
% Regression:
% [IWBLWTFTYPE] = elmtrain(PT20‘sig‘0)
% Y = elmtrain(PIWBLWTFTYPE)
% Classification
% [IWBLWTFTYPE] = elmtrain(PT20‘sig‘1)
% Y = elmtrain(PIWBLWTFTYPE)
% See also ELMTRAIN
% Yu Lei11-7-2010
% Copyright www.matlabsky.com
% $Revision:1.0 $
if nargin < 6
error(‘ELM:Arguments‘‘Not enough input arguments.‘);
end
% Calculate the layer Output Matrix H
Q = size(P2);
BiasMatrix = repmat(B1Q);
tempH = IW * P + BiasMatrix;
switch TF
case ‘sig‘
H = 1 ./ (1 + exp(-tempH));
case ‘sin‘
H = sin(tempH);
case ‘hardlim‘
H = hardlim(tempH);
end
% Calculate the Simulate Output
Y = (H‘ * LW)‘;
if TYPE == 1
temp_Y = zeros(size(Y));
for i = 1:size(Y2)
[max_Yindex] = max(Y(:i));
temp_Y(indexi) = 1;
end
Y = vec2ind(temp_Y);
end
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1454 2010-11-07 15:22 chapter30\elmpredict.m
文件 1752 2010-11-07 15:23 chapter30\elmtrain.m
文件 1105 2010-10-17 14:51 chapter30\iris_data.mat
文件 4313 2010-11-30 21:12 chapter30\main.m
文件 171497 2010-10-14 20:24 chapter30\spectra_data.mat
目录 0 2018-08-06 14:30 chapter30
----------- --------- ---------- ----- ----
180121 6
评论
共有 条评论