✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。
🍎个人主页:Matlab科研工作室
🍊个人信条:格物致知。
更多Matlab仿真内容点击👇
⛄ 内容介绍
Extreme learning machine (ELM), as one of the most useful techniques in machine learning, has attracted extensive attentions due to its unique ability for extremely fast learning. In particular, it is widely recognized that ELM has speed advantage while performing satisfying results. However, the presence of outliers may give rise to unreliable ELM model. In this paper, our study addresses the outlier robustness of ELM in regression problems. Based on the sparsity characteristic of outliers, this work proposes an outlier-robust ELM where the 1-norm loss function is used to enhance the robustness. Specially, the fast and accurate augmented Lagrangian multiplier method is applied to guarantee the effectiveness and efficiency. According to the experiments on function approximation and some real-world applications, the proposed approach not only maintains the advantages from original ELM, but also shows notable and stable accuracy in handling data with outliers.
⛄ 部分代码
% =========================================================================
% Outlier-robust extreme learning machine, Version 1.0
%
% ----------------------------------------------------------------------
% Permission to use, copy, or modify this software and its documentation
% for educational and research purposes only and without fee is here
% granted, provided that this copyright notice and the original authors'
% names appear on all copies and supporting documentation. This program
% shall not be used, rewritten, or adapted as the basis of a commercial
% software or hardware product without first obtaining permission of the
% authors. The authors make no representations about the suitability of
% this software for any purpose. It is provided "as is" without express
% or implied warranty.
%----------------------------------------------------------------------
%
% This is an implementation of the algorithm for "SinC" function regression
%
% Please cite the following paper if you use this code:
%
% Zhang, Kai, and Minxia Luo. "Outlier-robust extreme learning machine for regression problems."
% Neurocomputing 151 (2015): 1519-1527.
%
%--------------------------------------------------------------------------
clear all;clc;
k=20;
num=1;
nodes=20;
C=[0,2^15,2^15,2^30];
[traindata,trainlabel,testdata,testlabel] = sinc(k);
i=1;
NumberofHiddenNeurons=nodes;
NumberofTrainingData=size(traindata,2);
NumberofInputNeurons=size(traindata,1);
InputWeight=rand(NumberofHiddenNeurons,NumberofInputNeurons)*2-1;
BiasofHiddenNeurons=rand(NumberofHiddenNeurons,1);
%% method ELM
[TrainingTime1,TrainingAccuracy1,InputWeight, BiasofHiddenNeurons, OutputWeight] ...
= elm_train_main(InputWeight,BiasofHiddenNeurons,traindata,trainlabel, C(1), 1);
[TestingAccuracy1,TY1] = elm_predict(testdata,testlabel,InputWeight, BiasofHiddenNeurons, OutputWeight);
tracc1(i)=TrainingAccuracy1;
ttacc1(i)=TestingAccuracy1;
%% method Regularizd ELM
[TrainingTime2,TrainingAccuracy2,InputWeight, BiasofHiddenNeurons, OutputWeight] ...
= elm_train_main(InputWeight,BiasofHiddenNeurons,traindata,trainlabel, C(2), 2);
[TestingAccuracy2,TY2] = elm_predict(testdata,testlabel,InputWeight, BiasofHiddenNeurons, OutputWeight);
tracc2(i)=TrainingAccuracy2;
ttacc2(i)=TestingAccuracy2;
%% method ELM-MAD
[TrainingTime3,TrainingAccuracy3,InputWeight, BiasofHiddenNeurons, OutputWeight] ...
= elm_train_main(InputWeight,BiasofHiddenNeurons,traindata,trainlabel, C(3), 3);
[TestingAccuracy3,TY3] = elm_predict(testdata,testlabel,InputWeight, BiasofHiddenNeurons, OutputWeight);
tracc3(i)=TrainingAccuracy3;
ttacc3(i)=TestingAccuracy3;
%% method ELM-L1
[TrainingTime4,TrainingAccuracy4,InputWeight, BiasofHiddenNeurons, OutputWeight] ...
= elm_train_main(InputWeight,BiasofHiddenNeurons,traindata,trainlabel, C(4), 4);
[TestingAccuracy4,TY4] = elm_predict(testdata,testlabel,InputWeight, BiasofHiddenNeurons, OutputWeight);
tracc4(i)=TrainingAccuracy4;
ttacc4(i)=TestingAccuracy4;
% end
fprintf([' trainingRMSE testingRMSE\n'])
format longg
format compact
a=single([mean(tracc1),mean(ttacc1)])
b=single([mean(tracc2),mean(ttacc2)])
c=single([mean(tracc3),mean(ttacc3)])
d=single([mean(tracc4),mean(ttacc4)])
figure;
plot(traindata,trainlabel,'o','MarkerSize',5,'MarkerFaceColor','w','MarkerEdgeColor','k','linewidth',1.2);
hold on;
plot(testdata,testlabel,'k','linewidth',1.5);
hold on;
plot(testdata,TY1,'m','linewidth',1.5);
hold on;
plot(testdata,TY2,'b','linewidth',1.5);
hold on;
plot(testdata,TY3,'g','linewidth',1.5);
hold on;
plot(testdata,TY4,'r','linewidth',1.5);
axis([-11,11,-1.5,2]);
set(gca,'XTick',-11:1:11)
legend1=legend('Training data','Desired output','ELM','RELM','WRELM','ORELM');
set(legend1,'Position',[0.73 0.74 0.14 0.17]);
set (gcf,'Position',[0 0 880 610]);
saveas(gcf, 'Fig1_1.eps','psc2');
saveas(gcf, 'Fig1_1', 'fig');
save figure20_1;
⛄ 运行结果
⛄ 参考文献
[1] Zhang K , Luo M . Outlier-robust extreme learning machine for regression problems[J]. Neurocomputing, 2015, 151:1519-1527.
⛄ 完整代码
❤️部分理论引用网络文献,若有侵权联系博主删除
❤️ 关注我领取海量matlab电子书和数学建模资料