diff --git a/COVID-19/Prediction/.vs/Prediction/v16/.suo b/COVID-19/Prediction/.vs/Prediction/v16/.suo index 3be7b6d..5b02e30 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 2298e0b..07e0c3e 100644 --- a/COVID-19/Prediction/Prediction.sln +++ b/COVID-19/Prediction/Prediction.sln @@ -5,7 +5,7 @@ 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}" EndProject -Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "Holt_Linear_Trend", "Prediction\Holt_Linear_Trend.pyproj", "{3F8A3B3F-C79E-412C-8EE4-DA8FF5DB31A6}" +Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "ARIMA", "Prediction\ARIMA.pyproj", "{3F8A3B3F-C79E-412C-8EE4-DA8FF5DB31A6}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/COVID-19/Prediction/Prediction/Holt_Linear_Trend.py b/COVID-19/Prediction/Prediction/ARIMA.py similarity index 91% rename from COVID-19/Prediction/Prediction/Holt_Linear_Trend.py rename to COVID-19/Prediction/Prediction/ARIMA.py index 85826ae..6564e8f 100644 --- a/COVID-19/Prediction/Prediction/Holt_Linear_Trend.py +++ b/COVID-19/Prediction/Prediction/ARIMA.py @@ -36,13 +36,13 @@ yCNARIMA = testCN.copy() yUSARIMA = testUS.copy() #训练模型 -fitCNconfirmed = sm.tsa.statespace.SARIMAX(trainCN.Confirmed).fit() -fitCNrecovered = sm.tsa.statespace.SARIMAX(trainCN['Recovered']).fit() -fitCNdeaths = sm.tsa.statespace.SARIMAX(trainCN['Deaths']).fit() +fitCNconfirmed = sm.tsa.statespace.SARIMAX(trainCN['Confirmed'],trend='c').fit() +fitCNrecovered = sm.tsa.statespace.SARIMAX(trainCN['Recovered'],trend='c').fit() +fitCNdeaths = sm.tsa.statespace.SARIMAX(trainCN['Deaths'],trend='ct').fit() -fitUSconfirmed = sm.tsa.statespace.SARIMAX(trainUS.Confirmed,trend='ct').fit() -fitUSrecovered = sm.tsa.statespace.SARIMAX(trainUS['Recovered']).fit() -fitUSdeaths = sm.tsa.statespace.SARIMAX(trainUS['Deaths']).fit() +fitUSconfirmed = sm.tsa.statespace.SARIMAX(trainUS['Confirmed'],trend='ct').fit() +fitUSrecovered = sm.tsa.statespace.SARIMAX(trainUS['Recovered'],trend='ct').fit() +fitUSdeaths = sm.tsa.statespace.SARIMAX(trainUS['Deaths'],trend='ct').fit() #测试 yCNARIMA['SARIMAconfirmed'] = fitCNconfirmed.predict(start="2020-11-01", end="2020-12-09", dynamic=True) @@ -65,7 +65,7 @@ forecastCNARIMA['deathsPred'] = fitCNdeaths.predict(start="2020-12-10", end="202 forecastUSARIMA['Date'] = pd.to_datetime(forecastUSARIMA['Date'], format='%Y/%m/%d').values.astype('datetime64[h]') forecastUSARIMA['confirmedPred'] = fitUSconfirmed.predict(start="2020-12-10", end="2020-12-16", dynamic=True) forecastUSARIMA['recoveredPred'] = fitUSrecovered.predict(start="2020-12-10", end="2020-12-16", dynamic=True) -forecastUSARIMA['deathsPred'] = fitUSdeaths.predict(start="2020-12-10", end="2020-12-16", dynamic=True) +forecastUSARIMA['deathsPred'] = fitUSdeaths.predict(start="2020-12-10", end="2020-12-16", dynamic=False) #RMSE rmseCNARIMACon = pow(mean_squared_error(np.asarray(testCN['Confirmed']), np.asarray(yCNARIMA['SARIMAconfirmed'])),0.05) diff --git a/COVID-19/Prediction/Prediction/Holt_Linear_Trend.pyproj b/COVID-19/Prediction/Prediction/ARIMA.pyproj similarity index 93% rename from COVID-19/Prediction/Prediction/Holt_Linear_Trend.pyproj rename to COVID-19/Prediction/Prediction/ARIMA.pyproj index c05dbd0..4c5722a 100644 --- a/COVID-19/Prediction/Prediction/Holt_Linear_Trend.pyproj +++ b/COVID-19/Prediction/Prediction/ARIMA.pyproj @@ -11,7 +11,7 @@ . . - Holt_Linear_Trend + ARIMA ARIMA @@ -23,7 +23,7 @@ false - +