<jupyter_start><jupyter_text>Encoder<jupyter_code>model.layers[1].summary()<jupyter_output>Model: "encoder"
_________________________________________________________________
Layer (type)                 Output Shape              Param #   
=================================================================
encoder_input (InputLayer)   (None, 28, 28, 1)         0         
_________________________________________________________________
conv2d_1 (Conv2D)            (None, 14, 14, 32)        320       
_________________________________________________________________
conv2d_2 (Conv2D)            (None, 7, 7, 64)          18496     
_________________________________________________________________
flatten_1 (Flatten)          (None, 3136)              0         
_________________________________________________________________
latent_vector (Dense)        (None, 512)               1606144   
=================================================================
Total params: 1,624,960
Trainable params: 1,624,960
Non-trainable params: 0
_________________________________________________[...]<jupyter_text>Classifier<jupyter_code>model.layers[2].summary()
from keras.datasets import mnist
import numpy as np
(_, _), (x_test, testY) = mnist.load_data()
# image_size=28
image_size = x_test.shape[1]
# x_train = np.reshape(x_train, [-1, image_size, image_size, 1])
x_test = np.reshape(x_test, [-1, image_size, image_size, 1])
x_test = x_test.astype('float32') / 255

noise = np.random.normal(loc=0.5, scale=0.5, size=x_test.shape)
x_test_noisy = x_test + noise
import matplotlib.pyplot as plt
fig, axes = plt.subplots(2,5, figsize=(12,5))
axes = axes.flatten()
idx = np.random.randint(0,10000,size=10)
for i in range(10):
    axes[i].imshow(x_test_noisy[idx[i],:].reshape(28,28), cmap='gray')
    axes[i].axis('off') # hide the axes ticks
    axes[i].set_title(str(int(testY[idx[i]])), color= 'black', fontsize=25)
# plt.show()
from keras.utils import to_categorical
num_class=10
testY_onehot = to_categorical(testY, num_classes=num_class)
(loss, accuracy) = model.evaluate(x_test_noisy, testY_onehot,
	batch_size=128, verbose=1)
accuracy
p=model.predict(x_test_noisy)
y_pred=[]
y_test=[]
for i,v in enumerate(p):
    y_pred.append(np.argmax(v))
    y_test.append(np.argmax(testY_onehot[i]))


# %%
from sklearn.metrics import confusion_matrix,classification_report
confusion_matrix(y_test, y_pred)

# %%
print(classification_report(y_test,y_pred))<jupyter_output>precision    recall  f1-score   support

           0       0.97      0.99      0.98       980
           1       0.99      0.95      0.97      1135
           2       0.95      0.96      0.95      1032
           3       0.94      0.96      0.95      1010
           4       0.96      0.93      0.94       982
           5       0.95      0.93      0.94       892
           6       0.97      0.96      0.97       958
           7       0.97      0.93      0.95      1028
           8       0.86      0.97      0.91       974
           9       0.94      0.92      0.93      1009

    accuracy                           0.95     10000
   macro avg       0.95      0.95      0.95     10000
weighted avg       0.95      0.95      0.95     10000
{'fraction_non_alphanumeric': 0.13933915211970074, 'fraction_numerical': 0.08665835411471322, 'mean_word_length': 2.518640350877193, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '154863', 'license': 'MIT', 'n_tokens_mistral': 1169, 'n_tokens_neox': 1015, 'n_words': 211, 'path': 'results.ipynb', 'repo_name': 'GaneshVShinde/noised_image_classification', 'size': '3208'}