class Jarvis(Model):
def __init__(self):
Model.__init__(self)
self.model = Sequential()
# Convulational layers\w MaxPooling
self.model.add(Conv2D(64, (5, 5), activation="relu"))
self.model.add(MaxPooling2D((2, 2)))
self.model.add(Conv2D(64, (5, 5), activation="relu"))
self.model.add(MaxPooling2D((2, 2)))
# Flattening layers
self.model.add(Flatten())
# Dense layers
self.model.add(Dense(1000))
self.model.add(Dense(10, activation="softmax"))
# Compiling model
self.model.compile(optimizer="adam",
loss="categorical_crossentropy",
metrics=["accuracy"])
self.model.fit(x=train_x, y=train_y,
epochs=8, batch_size=100)
I'm loading the data like this
(train_x, train_y), (test_x, test_y) = tfds.load("glue", split="train", data_dir=os.path.dirname(__file__))
I would suggest you load your data using scikit-learn, as that is much better!
First load your data as a csv or excel file:
import pandas as pd
data = pd.read_csv('Example$Path$')
then you import train_test_split from scikitlearn:
from sklearn.model_selection import train_test_split
x_train, x_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=101)
#X and y over here are the columns of the data. X is the training columns and y is the column you are trying to predict