I am trying to predict the next set of numbers in my dataset sequence however using the predict function classifys the entire dataset, how can I change my code so that it predicts the next outcome in the sequence?
I was following this tutorial and his model outputs 80 based on 50,60,70 as his dataset. Yet mine just predicts the entire dataset? How to Get Started with Deep Learning for Time Series Forecasting (7-Day Mini-Course)
This is my dataset
and this is the code:
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.neural_network import MLPClassifier
from sklearn.metrics import classification_report,confusion_matrix
from numpy import loadtxt
from keras.models import Sequential
from keras.layers import Dense
# load the dataset
col_names = ['N1', 'N2', 'N3', 'N4', 'N5', 'L1', 'L2','label']
# load dataset
pima = pd.read_csv("dataset.csv", header=None, names=col_names)
pima.head()
feature_cols = ['N1', 'N2', 'N3', 'N4', 'N5', 'L1', 'L2']
X = pima[feature_cols] # Features
y = pima.label
model = Sequential()
model.add(Dense(122, input_dim=7, activation='relu'))
model.add(Dense(20, activation='relu'))
model.add(Dense(1, activation='sigmoid'))
model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])
model.fit(X, y, epochs=2000, batch_size=10)
# =======================
_, accuracy = model.evaluate(X, y)
print('Accuracy: %.2f' % (accuracy*100))
yhat = model.predict(X, verbose=0)
print(yhat) <- this outputs the predictions for the entire dataset and not the next prediction
Edit:
The output I am getting is this, for the entire dataset.
The dataset runs from 1 to 1251 rows and I want to predict row 1252 with an output of N1,N2,N3,N4,N5,L1,L2.