text_plain_output_1.png
from tensorflow import keras

import numpy as np

fashion_mnist = keras.datasets.fashion_mnist
(in_train, out_train), (in_valid, out_valid) = fashion_mnist.load_data()

(in_train.shape, in_valid.shape, np.unique(out_train))

in_train = in_train / 255.0
in_valid = in_valid / 255.0

model = keras.Sequential(layers=[keras.layers.Flatten(input_shape=(28, 28)), keras.layers.Dense(128, activation='relu'), keras.layers.Dense(10, activation='softmax')])
model.compile(optimizer='adam', loss='sparse_categorical_crossentropy', metrics=['accuracy'])
model.fit(in_train, out_train, batch_size=60, epochs=10, validation_split=0.2)

loss, accuracy = model.evaluate(in_valid, out_valid)