text_plain_output_1.png
from sklearn.model_selection import train_test_split

from tensorflow.keras.utils import to_categorical

import pandas as pd

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

train = pd.read_csv('/kaggle/input/digit-recognizer/train.csv')
test = pd.read_csv('/kaggle/input/digit-recognizer/test.csv')

(train.shape, test.shape)

X = train.drop('label', axis=1).values / 255.0
X = X.reshape(-1, 28, 28, 1)
X.shape

Y = train['label'].values
Y.shape

from tensorflow.keras.utils import to_categorical
Y = to_categorical(Y, num_classes=10)
Y.shape

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)
print(f'X_train: {X_train.shape}, y_train: {y_train.shape}')
print('-' * 50)
print(f'X_test: {X_test.shape}, y_test: {y_test.shape}')