模糊神经网络2--基于ANFIS的混沌时间序列预测
生活随笔
收集整理的這篇文章主要介紹了
模糊神经网络2--基于ANFIS的混沌时间序列预测
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
預測序列模型方程:
該預測模型常用于神經網絡的訓練:
1. 輸入輸出數據及處理
load mgdata.dat time = mgdata(:,1); x = mgdata(:, 2); figure(1) plot(time,x) title('Mackey-Glass Chaotic Time Series') xlabel('Time (sec)') ylabel('x(t)') %輸入輸出數據處理 for t = 118:1117 Data(t-117,:) = [x(t-18) x(t-12) x(t-6) x(t) x(t+6)]; end trnData = Data(1:500,:); chkData = Data(501:end,:);2. genfis生成初始系統
% 生成初始Sugeno FIS系統 fis = genfis(trnData(:,1:end-1),trnData(:,end),genfisOptions('GridPartition')); % genfis 默認每個輸入輸出量為 2 個generalized bell membership functions 隸屬函數,均勻分布 figure subplot(2,2,1) plotmf(fis,'input',1) subplot(2,2,2) plotmf(fis,'input',2) subplot(2,2,3) plotmf(fis,'input',3) subplot(2,2,4) plotmf(fis,'input',4)%**上述生成的初始系統應對16 條規則;
%**4輸入1輸出
%**待估計參數為104個
%**訓練數據為500個?
3. ANFIS系統配置及訓練
% ANFIS訓練 options = anfisOptions('InitialFIS',fis,'ValidationData',chkData); [fis1,error1,ss,fis2,error2] = anfis(trnData,options); %**fis1最佳擬合結構;fis2最佳預測結構訓練后系統隸屬函數:
% 訓練后隸屬函數 figure subplot(2,2,1) plotmf(fis2,'input',1) subplot(2,2,2) plotmf(fis2,'input',2) subplot(2,2,3) plotmf(fis2,'input',3) subplot(2,2,4) plotmf(fis2,'input',4)4. 訓練效果及擬合誤差
% 訓練及預測誤差曲線 figure plot([error1 error2]) hold on plot([error1 error2],'o') legend('Training error','Checking error') xlabel('Epochs') ylabel('Root Mean Squared Error') title('Error Curves')% ANFIS系統擬合效果 anfis_output = evalfis(fis2,[trnData(:,1:4); chkData(:,1:4)]); figure index = 125:1124; plot(time(index),[x(index) anfis_output]) xlabel('Time (sec)') title('MG Time Series and ANFIS Prediction') % 預測誤差 diff = x(index) - anfis_output; plot(time(index),diff) xlabel('Time (sec)') title('Prediction Errors')總結
以上是生活随笔為你收集整理的模糊神经网络2--基于ANFIS的混沌时间序列预测的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 数字人全集
- 下一篇: 《神经科学:探索脑》学习笔记(第7章 神