⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 continuetrainblueestimate.m

📁 matlab使用BP网络的例子,使用Levenberg Marquardt算法提高训练速度,效果不错
💻 M
字号:
%当训练评估过程trainBlueEstimation.m被中断后继续训练的代码

clear;
load state.mat;              %载入原来的训练情况
nown=n+1;
for n=nown:samplenum-1                                  %抽样训练
    net=init(net);                                      %为了更好的性能,,需要随机的初始化函数
	[net,tr]=train(net,TrainingSample(:,1:n),TrainingObject(:,1:n));
	prediction=sim(net,TrainingSample(:,n+1));    %预测值
	real=TrainingObject(:,n+1);                   %目标值
    MSE=tr.perf(size(tr.perf,2));                   %计算性能    
	if(abs(prediction-real)<0.6)                    %计算正确率
        correctnum=correctnum+1;
	end;
	if(GoodMSE>MSE)                                 %得到一个更好的网络
        save GoodBlueNetwork.txt net MSE pn tr n correctnum;    %训练过程要存下来
        GoodMSE=MSE;
	end;
    save state.mat;                                 %每做完一次训练后保存一次以便将来能继续
    save n.txt n MSE correctnum -ascii;                        %可以让我们看出当前训练到哪一步了,MSE是多少,预测能力是多少
end
num=samplenum-200;
ratio=correctnum/num;                               %正确率
save ratio.txt ratio -ascii;                        %记录正确率

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -