import numpy as np import pandas as pd import matplotlib.pyplot as plt data = pd.read_csv('https://jonghank.github.io/ase1302/files/numbers.csv', \ header=None).values m = 28 # 28x28: image size K = 10 # 10: each image represents one of 10 digits N = 10000 # 10000: number of images in the train set y = data[:,0] X = np.zeros((m,m,N)) for n in range(N): X[:,:,n] = data[n,1:].reshape((m,m)) print(X.shape, y.shape) n_examples = 12 print(f'First {n_examples} images:\n') plt.figure(figsize=(12,4), dpi=100) for n in range(n_examples): plt.subplot(1,n_examples,n+1) plt.imshow(X[:,:,n], cmap='gray') plt.axis('off') plt.show() print(f'First {n_examples} label:\n{y[:n_examples]}') # your code here # your code here # your code here # your code here # your code here # your code here