How can I predict the following value of time series using the Tensorflow predict method?

Thank you for reading. I’m not good at English.

I am wondering how to predict and get future time series data after model training.

I wonder if the time series data has been properly learned and predicted.

How can I do this right to get the following(next) value?

I have `x_test`

and `x_test[-1] == t`

So, the meaning of the next value is `t+1, t+2, .... t+n,`

in this example **I want to get t+1, t+2 ... t+n**

# First

I tried using stock index data

```
inputs = total_data[len(total_data) - forecast - look_back:]
inputs = scaler.transform(inputs)
X_test = []
for i in range(look_back, inputs.shape[0]):
X_test.append(inputs[i - look_back:i])
X_test = np.array(X_test)
predicted = model.predict(X_test)
```

but the result is like below

The results from `X_test[-20:]`

and the following 20 **predictions looks like same.**

I’m wondering if it’s the correct train and predicted value.

and I’m wondering if it was the right training and predict.

The method I tried first did not work correctly.

# Seconds

I realized something is wrong, I tried using another official data

So, I used the time series in the **Tensorflow tutorial** to practice predicting the model.

```
a = y_val[-look_back:]
for i in range(N-step prediction): #predict a new value n times.
tmp = model.predict(a.reshape(-1, look_back, num_feature)) #predicted value
a = a[1:] #remove first
a = np.append(a, tmp) #insert predicted value
```

The results were predicted in a linear regression shape very differently from the real data.

Output a linear regression abnormal that is independent of the real data:

full source (After the 25th line is my code.)

I’m really very curious that **How can I predict the following value of time series using Tensorflow predict method**

I’m not wondering if this works or not working with a theoretically. I’m just wondering how to **get the following n steps using the predict method.**

Thank you for reading the long question. I seek advice about your priceless opinion.

Tags: exception, pythonpython, tensorflow, time