%ELM:ELM基于近红外光谱的汽油测试集辛烷值含量预测结果对比—Jason niu load spectra_data.mat
temp = randperm(size(NIR,1)); P_train = NIR(temp(1:50),:)‘; T_train = octane(temp(1:50),:)‘; P_test = NIR(temp(51:end),:)‘; T_test = octane(temp(51:end),:)‘; N = size(P_test,2); [Pn_train,inputps] = mapminmax(P_train); Pn_test = mapminmax(‘apply‘,P_test,inputps); [Tn_train,outputps] = mapminmax(T_train); Tn_test = mapminmax(‘apply‘,T_test,outputps); [IW,B,LW,TF,TYPE] = elmtrain(Pn_train,Tn_train,30,‘sig‘,0); tn_sim = elmpredict(Pn_test,IW,B,LW,TF,TYPE); T_sim = mapminmax(‘reverse‘,tn_sim,outputps); result = [T_test‘ T_sim‘]; E = mse(T_sim - T_test); N = length(T_test); R2=(N*sum(T_sim.*T_test)-sum(T_sim)*sum(T_test))^2/((N*sum((T_sim).^2)-(sum(T_sim))^2)*(N*sum((T_test).^2)-(sum(T_test))^2)); figure(1) plot(1:N,T_test,‘r-*‘,1:N,T_sim,‘b:o‘) grid on legend(‘真实值‘,‘预测值‘) xlabel(‘样本编号‘) ylabel(‘辛烷值‘) string = {‘ELM:ELM基于近红外光谱的汽油测试集辛烷值含量预测结果对比—Jason niu‘;[‘(mse = ‘ num2str(E) ‘ R^2 = ‘ num2str(R2) ‘)‘]}; title(string)