clear all
clc
rand('state',3)
%%
addpath('codes','pso')
%% Options
Options.k=10; % incremental lraning parameters
Options.lambda=0.7; % incremental lraning parameters
Options.MaxHiddenNeurons=100; % maximaum number of hidden neurons
Options.ActivationFunType='radbas'; % activation function
population=exp(-0:0.5:4)'; % generate random initial population
Options.C(:,1)=population; % regularization parameter
Options.Weighted=population; % weighted ELM parameters
Options.epsilon=1e-3; % desired tolerance error
%% PSO
Options.epsilonPSO=10e-3; % desired tolerance error
Options.LB=100; % Lower bounds constraints
Options.UB=-100; % Upper bounds constraints
Options.maxite=3; % maximum number of iterations
Options.wmax=0.2; % inertial weight
Options.wmin=0.2; % inertial weight
Options.c1=2; % acceleration factor
Options.c2=2; % acceleration factor
%% dataset
load('FD001')
xtr=DATA.X_batch;
ytr=DATA.Y_batch;
xts=DATA.Xts_batch;
yts=DATA.Yts_batch;
%% Training
i=17;
[neta] = LCIELM(xtr,ytr,xts,yts,DATA.Xts{i},Options) % LCI-ELM
[netb] = LOO_RT_LCI_ELM(xtr,ytr,xts,yts,DATA.Xts{i},Options)% Leave One Out Regularized LCI-ELM
[netc] = OP_W_LCI_ELM(xtr,ytr,xts,yts,DATA.Xts{i},Options) % PSO for weighted LCI-ELM
%% Plot population variation
subplot(121)
plot(1:length(netc.reg(:,2)),netc.reg(:,2),'k:'...
,1:length(netc.reg(:,2)),netc.reg(:,1),'k*'...
,'LineWidth',2)
xlabel('Iterations'...
,'FontName','Times New Roman','FontSize',14)
ylabel('C and W'...
,'FontName','Times New Roman','FontSize',14)
title('(a) Balancing parameters'...
,'FontName','Times New Roman','FontSize',14)
legend('regularization parameter','weighted ELM parameters')
%% plot (Error)
subplot(122)
f=30;
plot(neta.nodes,smooth(neta.E,f),'k',...
netb.nodes,smooth(netb.E,f),'k--',...
netc.nodes,smooth(netc.E,f),...
'k:','LineWidth',2);
xlabel('Hidden nodes'...
,'FontName','Times New Roman','FontSize',14)
ylabel('Training RMSE'...
,'FontName','Times New Roman','FontSize',14)
title('(b) Training accuracy'...
,'FontName','Times New Roman','FontSize',14)
legend('LCI-ELM','LR-LCI-ELM','PW-LCI-ELM');
%% plot (Score)
figure(2)
subplot(131)
plot(neta.d,neta.S,'k.',neta.d,neta.er,'k*')
xlabel('RUL error'...
,'FontName','Times New Roman','FontSize',14)
ylabel('RMSE and Score'...
,'FontName','Times New Roman','FontSize',14)
title('(a) LCI-ELM'...
,'FontName','Times New Roman','FontSize',14)
legend('Score','RMSE');
%%%%
subplot(132)
plot(netb.d,netb.S,'k.',netb.d,netb.er,'k*')
xlabel('RUL error'...
,'FontName','Times New Roman','FontSize',14)
ylabel('RMSE and Score'...
,'FontName','Times New Roman','FontSize',14)
title('(b) LR-LCI-ELM'...
,'FontName','Times New Roman','FontSize',14)
legend('Score','RMSE');
%%%%
subplot(1,3,3)
plot(netc.d,netc.S,'k.',netc.d,netc.er,'k*')
xlabel('RUL error'...
,'FontName','Times New Roman','FontSize',14)
ylabel('RMSE and Score'...
,'FontName','Times New Roman','FontSize',14)
title('(c) PW-LCI-ELM'...
,'FontName','Times New Roman','FontSize',14)
legend('Score','RMSE');
%%%%