资源简介
使用emd进行回归预测的代码,使用方法结单,只需输入训练集和测试集就可以进行emd预测了,预测的结果会保存在相应的.mat文件里,详细操作请看代码里的操作说明。资源里有demo,guidence.m文件里有调用实例,直接复制到command windows里运行就可以了,简单易懂,汉语注释说明等。运行结果会直接输出测试集的MAE, RMSE, MAPE, DISTAT这几个统计量
代码片段和文件信息
function [MAE RMSE MAPE DISTAT]= ELM(TrainingData_File TestingData_File NumberofHiddenNeurons ActivationFunction)
%author:xiaobei
%blog:http://blog.csdn.net/lijjianqing
%Email:1600185439@qq.com
%回归预测,模型保存在elm_model.mat中;训练集预测结果保存在elm_output_train.mat中;测试集预测结果保存在
%elm_output_test.mat中;测试集的统计量保存在elm_result.mat中
% Input:
% TrainingData_File - Filename of training data set
% TestingData_File - Filename of testing data set
% NumberofHiddenNeurons - Number of hidden neurons assigned to the ELM
% ActivationFunction - Type of activation function:
% ‘sig‘ for Sigmoidal function
% ‘sin‘ for Sine function
% ‘hardlim‘ for Hardlim function
% ‘tribas‘ for Triangular basis function
% ‘radbas‘ for Radial basis function (for additive type of SLFNs instead of RBF type of SLFNs)
%
% Output:(输出测试集的统计量)
% MAE
% RMSE
% MAPE
% DISTAT
% TrainingTime - Time (seconds) spent on training ELM
% TestingTime - Time (seconds) spent on predicting ALL testing
%训练集的统计量
% MAE_TRA
% RMSE_TRA
% MAPE_TRA
% DISTAT_TRA
%%%参照文献及资源说明
%reference:
%%%% Authors: MR QIN-YU ZHU AND DR GUANG-BIN HUANG
%%%% NANYANG TECHNOLOGICAL UNIVERSITY SINGAPORE
%%%% EMAIL: EGBHUANG@NTU.EDU.SG; GBHUANG@IEEE.ORG
%%%% WEBSITE: http://www.ntu.edu.sg/eee/icis/cv/egbhuang.htm
%%%% DATE: APRIL 2004
%%%%
%%%%%%%%%%% Load training dataset
train_data=load(TrainingData_File);
T=train_data(:1)‘;
P=train_data(:2:size(train_data2))‘;
clear train_data; % Release raw training data array
%%%%%%%%%%% Load testing dataset
test_data=load(TestingData_File);
TV.T=test_data(:1)‘;
TV.P=test_data(:2:size(test_data2))‘;
clear test_data; % Release raw testing data array
NumberofTrainingData=size(P2);
NumberofTestingData=size(TV.P2);
NumberofInputNeurons=size(P1);
%%%%%%%%%%% Calculate weights & biases
start_time_train=cputime;
%%%%%%%%%%% Random generate input weights InputWeight (w_i) and biases BiasofHiddenNeurons (b_i) of hidden neurons
InputWeight=rand(NumberofHiddenNeuronsNumberofInputNeurons)*2-1;
BiasofHiddenNeurons=rand(NumberofHiddenNeurons1);
tempH=InputWeight*P;
clear P; % Release input of training data
ind=ones(1NumberofTrainingData);
BiasMatrix=BiasofHiddenNeurons(:ind); % Extend the bias matrix BiasofHiddenNeurons to match the demention of H
tempH=tempH+BiasMatrix;
%%%%%%%%%%% Calculate hidden neuron output matrix H
switch lower(ActivationFunction)
case {‘sig‘‘sigmoid‘}
%%%%%%%% Sigmoid
H = 1 ./ (1 + exp(-tempH));
case {‘sin‘‘sine‘}
%%%%%%%% Sine
H = sin(tempH);
case {‘hardlim‘}
%%%%%%%% Hard Limit
H = double(hardl
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2014-12-16 23:23 ELM\
文件 6554 2014-12-16 23:22 ELM\ELM.m
文件 191 2014-12-16 23:23 ELM\guidence.m
文件 323 2014-12-16 22:24 ELM\testdata
文件 2649 2014-12-16 22:24 ELM\traindata
- 上一篇:leach算法改进
- 下一篇:hmm的matlab源代码
评论
共有 条评论