diff --git a/COVID-19/Prediction/.vs/Prediction/v16/.suo b/COVID-19/Prediction/.vs/Prediction/v16/.suo index edfed0d..57e942b 100644 Binary files a/COVID-19/Prediction/.vs/Prediction/v16/.suo and b/COVID-19/Prediction/.vs/Prediction/v16/.suo differ diff --git a/COVID-19/Prediction/Prediction.sln b/COVID-19/Prediction/Prediction.sln index 07e0c3e..ad9d8ea 100644 --- a/COVID-19/Prediction/Prediction.sln +++ b/COVID-19/Prediction/Prediction.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.30804.86 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "Holt_Winters", "Prediction\Holt_Winters.pyproj", "{FE4194E6-8A95-4B93-968D-ED4305D7F944}" +Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "ExponentialSmoothing", "Prediction\ExponentialSmoothing.pyproj", "{FE4194E6-8A95-4B93-968D-ED4305D7F944}" EndProject Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "ARIMA", "Prediction\ARIMA.pyproj", "{3F8A3B3F-C79E-412C-8EE4-DA8FF5DB31A6}" EndProject diff --git a/COVID-19/Prediction/Prediction/CN.py b/COVID-19/Prediction/Prediction/CN.py index 4888244..573ba8b 100644 --- a/COVID-19/Prediction/Prediction/CN.py +++ b/COVID-19/Prediction/Prediction/CN.py @@ -19,6 +19,27 @@ dataset = dataset[['Country/Region','Confirmed','Recovered','Deaths','Date']].gr CN = dataset[dataset['Country/Region'] == 'China'] CN.index = pd.Index(pd.date_range('2020-01-22','2020-12-09',freq = '1D')) +#画出原始数据 +fig0 = plt.figure() +axcon = fig0.add_subplot(221) +axcon.set_title("Confirmed") +confirmedSeries = pd.DataFrame(CN['Confirmed']) +confirmedSeries = confirmedSeries.fillna(0) +axcon.plot(confirmedSeries) + +axrec = fig0.add_subplot(222) +axrec.set_title("Recovered") +recoveredSeries = pd.DataFrame(CN['Recovered']) +recoveredSeries = recoveredSeries.fillna(0) +axrec.plot(recoveredSeries) + +axdea = fig0.add_subplot(223) +axdea.set_title("Deaths") +deathsSeries = pd.DataFrame(CN['Deaths']) +deathsSeries = deathsSeries.fillna(0) +axdea.plot(deathsSeries) +plt.show() + #差分后可视化 fig1 = plt.figure() axcon = fig1.add_subplot(221) @@ -41,6 +62,8 @@ deathsSeries = pd.DataFrame(CN['Deaths']) deathsSeries = deathsSeries.fillna(0) deathsSeries['Deaths'] = deathsSeries['Deaths'] - deathsSeries['Deaths'].shift(1) axdea.plot(deathsSeries) +plt.tight_layout() + plt.show() #ADF检验 diff --git a/COVID-19/Prediction/Prediction/Holt_Winters.py b/COVID-19/Prediction/Prediction/ExponentialSmoothing.py similarity index 97% rename from COVID-19/Prediction/Prediction/Holt_Winters.py rename to COVID-19/Prediction/Prediction/ExponentialSmoothing.py index 75e8a31..1915684 100644 --- a/COVID-19/Prediction/Prediction/Holt_Winters.py +++ b/COVID-19/Prediction/Prediction/ExponentialSmoothing.py @@ -52,6 +52,11 @@ rmseCNexpCon = pow(mean_squared_error(np.asarray(testCN['Confirmed']), np.asarra rmseCNexpRec = pow(mean_squared_error(np.asarray(testCN['Recovered']), np.asarray(yCNexp['recoveredTest'])),0.05) rmseCNexpDea = pow(mean_squared_error(np.asarray(testCN['Deaths']), np.asarray(yCNexp['deathsTest'])),0.5) +print(rmseCNexpCon) +print(rmseCNexpRec) +print(rmseCNexpDea) + + #可视化 plt.title("Holt-Winters",verticalalignment="bottom",fontsize="13") @@ -73,4 +78,6 @@ plt.plot(forecastCNexp['deathsPred'],label="deaths prediction") plt.tight_layout() plt.gcf().autofmt_xdate() plt.legend(labelspacing=0.05) -plt.show() \ No newline at end of file +plt.show() + +print(forecastCNexp) \ No newline at end of file diff --git a/COVID-19/Prediction/Prediction/Holt_Winters.pyproj b/COVID-19/Prediction/Prediction/ExponentialSmoothing.pyproj similarity index 90% rename from COVID-19/Prediction/Prediction/Holt_Winters.pyproj rename to COVID-19/Prediction/Prediction/ExponentialSmoothing.pyproj index 85c7ea9..bbeb406 100644 --- a/COVID-19/Prediction/Prediction/Holt_Winters.pyproj +++ b/COVID-19/Prediction/Prediction/ExponentialSmoothing.pyproj @@ -5,12 +5,12 @@ fe4194e6-8a95-4b93-968d-ed4305d7f944 - Holt_Winters.py + ExponentialSmoothing.py . . - Holt_Winters + ExponentialSmoothing Prediction @@ -22,7 +22,7 @@ false - +