Closed cdhx closed 5 years ago
I have the same issue, how you solve that?
yeah I find this problem cuz I want to test if this code can run on my script,so I just set epoch equal to 1,after I set it to 300 or more ,it works well. hope canhelp you
---Original--- From: "Jiwei"notifications@github.com Date: Wed, May 15, 2019 22:28 PM To: "farizrahman4u/seq2seq"seq2seq@noreply.github.com; Cc: "State change"state_change@noreply.github.com;"cdhx"1430398921@qq.com; Subject: Re: [farizrahman4u/seq2seq] predicte wrong answer using seq2seq model(all test sample predicte same answer) (#273)
I have the same issue, how you solve that?
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or mute the thread.
i am dealing with a task of traffic flow predict,data is every hour's traffic flow,i want to use past 120 hours data to predict next 3 hours data,here is the code
my problem is :i find that all my predict are the same in every sample,if i reshape the prediction to 3 columns(which is my ouotput_length) it is clearly that there are three columns and every element in same column is same
input_length = 120 input_dim = 1
output_length = 3 output_dim = 1
hidden_dim = 50
model=AttentionSeq2Seq(output_dim=output_dim, hidden_dim=hidden_dim, output_length=output_length, input_shape=(input_length, input_dim), depth=3,dropout=0.3) model.compile(loss='mse', optimizer='adam') model.fit(x,y, epochs=1)
==============================evaluate on test===============================
testing_complete = pd.read_csv(r'C:\Users\pc\Dropbox\Performance_Comparison\Code-Fan\new_data\original_data\regentstreet_north_test.csv')
testing_processed = testing_complete.iloc[:, 1:2].values #the data column of test.csv
concat train and test
total = pd.concat((training_complete['count'], testing_complete['count']), axis=0)
got last input_length part of train and test
for i need last input_length of train to predict test's first grandetruth
test_inputs = total[len(total) - len(testing_complete) - input_length:].values test_inputs = test_inputs.reshape(-1,1)
test_inputs = scaler.transform(test_inputs)
test_features = []
for i in range(input_length, 672+input_length):
test_features.append(test_inputs[i-input_length:i, 0])
test_features = np.array(test_features)
test_features = np.reshape(test_features, (test_features.shape[0], test_features.shape[1], 1))
predictions = model.predict(test_features)
predictions = np.reshape(predictions,(672,3)) predictions = scaler.inverse_transform(predictions)`