<jupyter_start><jupyter_text>Saving the model<jupyter_code>model.save('mnist.h5')<jupyter_output><empty_output><jupyter_text>Testing saved model<jupyter_code>new_model = keras.models.load_model('mnist.h5')
new_model.summary()
score = new_model.evaluate(x_test, y_test, verbose=0)
print("Test loss:", score[0])
print("Test accuracy:", score[1])
x_test[0].shape
y_test[0]
preds = model.predict(x_test[0:1])
preds.shape<jupyter_output><empty_output><jupyter_text>https://keras.io/examples/vision/mnist_convnet/  Export validation inputs and outputs<jupyter_code>val_size = 100
indexes = [np.random.randint(10000, size=val_size)]
indexes
np.savetxt("mnist-input-100.csv", x_test[tuple(indexes)].reshape([val_size, 28*28]), delimiter=",")
np.savetxt("mnist-output-100.csv", y_test[tuple(indexes)], delimiter=",")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16726403823178015, 'fraction_numerical': 0.03225806451612903, 'mean_word_length': 10.479452054794521, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '17922', 'license': 'MIT', 'n_tokens_mistral': 354, 'n_tokens_neox': 330, 'n_words': 39, 'path': 'model/mnist-classification.ipynb', 'repo_name': 'zhovtobruhd/mnist-429disc', 'size': '837'}