text_plain_output_1.png
import matplotlib.pyplot as plt

import pandas as pd

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

import random

import random

import seaborn as sns

data = pd.read_csv('/kaggle/input/fashionmnist/fashion-mnist_train.csv')

import random
classes = ['T-shirt', 'Trouser', 'Pullover', 'Dress', 'Coat', 'Sandal', 'Shirt', 'Sneaker', 'Bag', 'A-boot']
samples_per_class = 10
num_classes = len(classes)
fig, axs = plt.subplots(samples_per_class, num_classes, figsize=(10, 10))
fig.subplots_adjust(hspace=0.5)
for i in range(samples_per_class):
    for j in range(num_classes):
        cls = classes[j]
        ind = random.choice((y_train == j).nonzero()[0])
        img = X_train[ind].reshape((28, 28))
        axs[i, j].imshow(img, cmap=plt.cm.gray)
        axs[i, j].axis('off')
        if i == 0:
            axs[i, j].set_title(cls)
plt.show()