From b8e6dfcbc20b819d58dd69824a9fb542b7cdafeb Mon Sep 17 00:00:00 2001 From: Newnius Date: Sat, 2 May 2020 08:50:39 +0800 Subject: [PATCH] update --- .idea/workspace.xml | 61 ++++++++++++++++++++++----------------------- train.py | 10 ++++---- 2 files changed, 35 insertions(+), 36 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 42c1a53..38fa7ac 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,7 +3,6 @@ - @@ -224,7 +223,7 @@ - + @@ -265,12 +264,12 @@ - @@ -363,12 +362,23 @@ - + - - + + - + + + + + + + + + + + + @@ -383,23 +393,12 @@ - + - - + + - - - - - - - - - - - - + diff --git a/train.py b/train.py index b09f6b8..9f63cf8 100644 --- a/train.py +++ b/train.py @@ -111,18 +111,18 @@ lstm_model.predict(train_reshaped, batch_size=1) # walk-forward validation on the test data predictions = list() -for i in range(len(test_scaled)): +for j in range(len(test_scaled)): # make one-step forecast - X, y = test_scaled[i, 0:-1], test_scaled[i, -1] + X, y = test_scaled[j, 0:-1], test_scaled[j, -1] yhat = forecast_lstm(lstm_model, 1, X) # invert scaling yhat = invert_scale(scaler, X, yhat) # invert differencing - yhat = inverse_difference(raw_values, yhat, len(test_scaled) + 1 - i) + yhat = inverse_difference(raw_values, yhat, len(test_scaled) + 1 - j) # store forecast predictions.append(yhat) - expected = raw_values[len(train) + i + 1] - print('Month=%d, Predicted=%f, Expected=%f' % (i + 1, yhat, expected)) + expected = raw_values[len(train) + j + 1] + print('Month=%d, Predicted=%f, Expected=%f' % (j + 1, yhat, expected)) # report performance rmse = sqrt(mean_squared_error(raw_values[-12:], predictions))