NN:实现BP神经网络的回归拟合,基于近红外光谱的汽油辛烷值含量预测结果对比—Jason niu...

本文介绍了一种使用近红外光谱数据预测油品辛烷值的方法。通过MATLAB编程实现数据预处理、模型训练及预测结果可视化。采用mapminmax进行数据归一化,newff建立前馈神经网络模型,sim函数进行模型仿真,最终通过R2值评估模型预测精度。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

load spectra_data.mat 
plot(NIR')   
title('Near infrared spectrum curve—Jason niu')

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);  

[p_train, ps_input] = mapminmax(P_train,0,1);  
p_test = mapminmax('apply',P_test,ps_input);  

[t_train, ps_output] = mapminmax(T_train,0,1);   

net = newff(p_train,t_train,9);

net.trainParam.epochs = 1000;
net.trainParam.goal = 1e-3;   
net.trainParam.lr = 0.01;    

net = train(net,p_train,t_train);  

t_sim = sim(net,p_test);

T_sim = mapminmax('reverse',t_sim,ps_output);

error = abs(T_sim - T_test)./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)); 

result = [T_test' T_sim' error']

figure
plot(1:N,T_test,'b:*',1:N,T_sim,'r-o')
legend('Real value','predicted value')
xlabel('Prediction sample')
ylabel('Octane numbe')
string = {'Comparison of the prediction results of the octane number in the test set—Jason niu';['R^2=' num2str(R2)]};
title(string)

 

 

转载于:https://www.cnblogs.com/yunyaniu/p/8419363.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值