 importtensorflow
 from tensorflowimportkeras
 from tensorflow.kerasimport Sequential
 from tensorflow.keras.layersimportDense,Flatten
 (X_train,y_train),(X_test,y_test) = 
keras.datasets.mnist.load_data()

X_test.shape
 X_train.shape
 y_train.shape
 y_test.shape

 y_train

 import matplotlib.pyplotasplt
 plt.imshow(X_train[2])

  X_train = X_train/255
 X_test = X_test/255

X_train[0]

model = Sequential()
 model.add(Flatten(input_shape=(28,28)))
 model.add(Dense(128,activation='relu'))
 model.add(Dense(32,activation='relu'))
 model.add(Dense(10,activation='softmax'))

model.summary()

 model.compile(loss='sparse_categorical_crossentropy',optimizer='Adam',m
 etrics=['accuracy'])

 history = 
model.fit(X_train,y_train,epochs=25,validation_split=0.2)

 y_prob = model.predict(X_test)
 y_pred = y_prob.argmax(axis=1)

  from sklearn.metrics import accuracy_score
 accuracy_score(y_test,y_pred)

  plt.plot(history.history['loss'])
 plt.plot(history.history['val_loss'])
 plt.plot(history.history['accuracy'])
 plt.plot(history.history['val_accuracy'])

  plt.imshow(X_test[1])
 model.predict(X_test[1].reshape(1,28,28)).argmax(axis=1)

