print("in some cases there will be some warning in the beginning dont worry about that until execution is completed")
 import tensorflow
 from tensorflow import keras
 from tensorflow.keras import Sequential
 from tensorflow.keras.layers import Dense,Flatten
 (X_train,y_train),(X_test,y_test) = keras.datasets.mnist.load_data()

 # print(X_test.shape)
 # X_train.shape
 # y_train.shape
 # y_test.shape

 # y_train

 import matplotlib.pyplot as plt
 # 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',metrics=['accuracy'])

 history =model.fit(X_train,y_train,epochs=2,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.show()

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