当前位置:   article > 正文

基于模糊神经网络的时间序列预测(以hopkinsirandeath数据集为例,MATLAB)_模糊神经网络数据集

模糊神经网络数据集

模糊神经网络从提出发展到今天,主要有三种形式:算术神经网络、逻辑模糊神经网络和混合模糊神经网络。算术神经网络是最基本的,它主要是对输入量进行模糊化,且网络结构中的权重也是模糊权重;逻辑模糊神经网络的主要特点是模糊权值可以进行逻辑运算操作;混合模糊神经网络是对于基本的模糊神经网络而言,其内的传统函数和模糊权值的运算都是随意的不同的。模糊神经网络发展到今天,已经从理论研究应用到工业生产和人们生活中的各个领域。模糊神经网络已经在模式识别、图像处理、工业控制生产等各个领域取得了不少成果。

鉴于此,采用Takagi Sugeno Kang模糊神经网络对时间序列进行预测,以hopkinsirandeat数据为例进行说明,程序运行环境为MATLAB R2021B。主运行代码如下:

  1. close all;clc;clear all
  2. dat=load('hopkinsirandeath.txt')';
  3. dat1=load('hopkinsiranconfirmed.txt')';
  4. dat2=load('hopkinsiranrecovered.txt')';
  5. % Nonlinear ARX model to fit
  6. sys = nlarx(dat,64);
  7. sys1 = nlarx(dat1,64);
  8. sys2 = nlarx(dat2,64);
  9. % Compare the simulated output of sys with measured data to ensure it is a good fit.
  10. nstep = 40;
  11. figure;
  12. set(gcf, 'Position', [50, 200, 1300, 400])
  13. subplot(1,3,1)
  14. compare(dat,sys,nstep);title('Covid Iran Death');
  15. grid on;
  16. subplot(1,3,2)
  17. compare(dat1,sys1,nstep);title('Covid Iran Confirm');
  18. grid on;
  19. subplot(1,3,3)
  20. compare(dat2,sys2,2);title('Covid Iran Recovered');
  21. grid on;
  22. % Forecast the values into the future for a given time horizon K.
  23. % K is number of days
  24. K = 180;
  25. opt = forecastOptions('InitialCondition','e');
  26. [p,ForecastMSE] = forecast(sys,dat,K,opt);
  27. [p1,ForecastMSE1] = forecast(sys1,dat1,K,opt);
  28. [p2,ForecastMSE2] = forecast(sys2,dat2,K,opt);
  29. datsize=size(dat);datsize=datsize(1,1);
  30. ylbl=datsize+K;
  31. t = linspace(datsize,ylbl,length(p));
  32. figure;
  33. set(gcf, 'Position', [1, 1, 1000, 950])
  34. subplot(3,1,1)
  35. plot(dat,'--',...
  36. 'LineWidth',1,...
  37. 'MarkerSize',5,...
  38. 'Color',[0,0,0]);
  39. hold on;
  40. plot(t,p,'-.',...
  41. 'LineWidth',2,...
  42. 'MarkerSize',10,...
  43. 'MarkerEdgeColor','r',...
  44. 'Color',[0.9,0,0]);
  45. title('Johns Hopkins Data for Iran COVID Deaths - Red is Forcasted')
  46. xlabel('Days - From Jan 2020 Till Dec 2021','FontSize',12,...
  47. 'FontWeight','bold','Color','b');
  48. ylabel('Number of People','FontSize',12,...
  49. 'FontWeight','bold','Color','b');
  50. datetick('x','mmm');
  51. legend({'Measured','Forecasted'});
  52. subplot(3,1,2)
  53. plot(dat1,'--',...
  54. 'LineWidth',1,...
  55. 'MarkerSize',5,...
  56. 'Color',[0,0,0]);
  57. hold on;
  58. plot(t,p1,'-.',...
  59. 'LineWidth',2,...
  60. 'MarkerSize',10,...
  61. 'MarkerEdgeColor','r',...
  62. 'Color',[0.9,0,0]);
  63. title('Johns Hopkins Data for Iran COVID Confirmed - Red is Forcasted')
  64. xlabel('Days - From Jan 2020 Till Dec 2021','FontSize',12,...
  65. 'FontWeight','bold','Color','b');
  66. ylabel('Number of People','FontSize',12,...
  67. 'FontWeight','bold','Color','b');
  68. datetick('x','mmm');
  69. legend({'Measured','Forecasted'});
  70. subplot(3,1,3)
  71. plot(dat2,'--',...
  72. 'LineWidth',1,...
  73. 'MarkerSize',5,...
  74. 'Color',[0,0,0]);
  75. hold on;
  76. plot(t,p2,'-.',...
  77. 'LineWidth',2,...
  78. 'MarkerSize',10,...
  79. 'MarkerEdgeColor','r',...
  80. 'Color',[0.9,0,0]);
  81. title('Johns Hopkins Data for Iran COVID Recovered - Red is Forcasted')
  82. xlabel('Days - From Jan 2020 Till Dec 2021','FontSize',12,...
  83. 'FontWeight','bold','Color','b');
  84. ylabel('Number of People','FontSize',12,...
  85. 'FontWeight','bold','Color','b');
  86. datetick('x','mmm');
  87. legend({'Measured','Forecasted'});
  88. %
  89. finalpredict=[dat;p];
  90. finalpredict1=[dat1;p1];
  91. finalpredict2=[dat2;p2];
  92. %% Predicting original and forcasted data using ANFIS (FCM)
  93. [TrainTargets,TrainOutputs]=fuzzfcm(finalpredict);
  94. figure;
  95. set(gcf, 'Position', [10, 50, 1100, 300])
  96. Plotit(TrainTargets,TrainOutputs,'ANFIS Predict COVID Deaths');
  97. %
  98. [TrainTargets,TrainOutputs]=fuzzfcm(finalpredict1);
  99. figure;
  100. set(gcf, 'Position', [50, 100, 1100, 300])
  101. Plotit(TrainTargets,TrainOutputs,'ANFIS Predict COVID Confirmed');
  102. %
  103. [TrainTargets,TrainOutputs]=fuzzfcm(finalpredict2);
  104. figure;
  105. set(gcf, 'Position', [70, 130, 1100, 300])
  106. Plotit(TrainTargets,TrainOutputs,'ANFIS Predict COVID Recovered');
  107. 完整代码:https://mbd.pub/o/bread/mbd-ZJWWm5hv

图片

图片

图片

图片

图片

擅长领域:现代信号处理,机器学习,深度学习,数字孪生,时间序列分析,设备缺陷检测、设备异常检测、设备智能故障诊断与健康管理PHM等。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/木道寻08/article/detail/790355
推荐阅读
相关标签
  

闽ICP备14008679号