import tensorflow as tf
from tensorflow import keras
import matplotlib.pyplot as plt
%matplotlib inline
fashion_mnist = keras.datasets.fashion_mnist
(train_images,train_labels),(test_images,test_labels) = fashion_mnist.load_data()
train_images = train_images/255.0
test_images = test_images/255.0
train_images.shape
input = keras.Input(shape=(28, 28))
x = keras.layers.Flatten()(input)
x = keras.layers.Dense(32,activation="relu")(x)
x = keras.layers.Dropout(0.5)(x)
x = keras.layers.Dense(64,activation="relu")(x)
output = keras.layers.Dense(10,activation="softmax")(x)
model = keras.Model(inputs=input,outputs=output)
model.summary()
model.compile(optimizer="adam",
loss="sparse_categorical_crossentropy",
metrics=["accuracy"]
)
history = model.fit(train_images,
train_labels,
epochs=30,
validation_data=(test_images,test_labels))