0

My sample data are as follows. enter image description here

I have a bigger dataset. In this dataset I want to predict the next date text.

The codes I want to run are like this.

import pandas as pd
import numpy as np
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense
from sklearn.model_selection import train_test_split,GridSearchCV,cross_val_score
from sklearn.metrics import mean_squared_error,r2_score
from sklearn import model_selection
from sklearn.neighbors import KNeighborsRegressor
from warnings import filterwarnings
from sklearn.metrics import mean_squared_error, mean_absolute_error
from tensorflow.keras.callbacks import EarlyStopping
filterwarnings('ignore')

data = pd.read_excel("datasets.xlsx")
data.head()




x_train, x_test, y_train, y_test = train_test_split(x,y,test_size=0.2,random_state=10)

model = Sequential() 
model.add(Dense(30,activation="relu"))
model.add(Dense(15,activation="relu"))
model.add(Dense(15,activation="relu"))
model.add(Dense(15,activation="relu"))
model.add(Dense(1))
model.compile(optimizer="adam",loss="mse")

model.fit(x=x_train, y = y_train,validation_data=(x_test,y_test),batch_size=50,epochs=300)

I don't know exactly how to separate x and y here.I tried separating x and y as columns before, but I was not successful in this dataset. In this dataset, I need to separate x and y as rows. As you can see I could only create the model Also, do I need to use a tokenizer here? Anyone who can help with a sample code?

ranka47
  • 995
  • 8
  • 25
  • You have no variables "x" and "y" defined, therefore split wouldn't work. Also, if your input data should be only dates and output is text, I guess you're doing NLP wrong. – crusher083 Mar 22 '21 at 12:01
  • I didn't define x and y on purpose because I don't know how to separate them as rows. – eVAL onger Mar 22 '21 at 12:12
  • Not to cast a shade, but if you don't know how to separate rows in pandas, start from pandas & numpy and leave Deep Learning for later. – crusher083 Mar 22 '21 at 12:13
  • Does this answer your question? [How do I create test and train samples from one dataframe with pandas?](https://stackoverflow.com/questions/24147278/how-do-i-create-test-and-train-samples-from-one-dataframe-with-pandas) – ranka47 Mar 22 '21 at 21:12

0 Answers0