<jupyter_start><jupyter_text><jupyter_code>score = model.evaluate(X_test, y_test, verbose=1)
print('Test accuracy: {:0.2f}%'.format(score[1] * 100))
import matplotlib.pyplot as plt
from random import randint
%matplotlib inline
idx = randint(0, X.shape[0])
print(idx)
plt.imshow(X[idx].reshape(28,28), cmap='binary')
print(label_names[int(y[idx].item())])

# !pip install tensorflowjs
# with open('class_names25.txt', 'w') as file_handler:
#   for item in cat_limit:
#     file_handler.write(f'{item}')
# model.save('keras25.h5')
# !mkdir model
# !tensorflowjs_converter --input_format keras keras25.h5 model/
# !cp class_names25.txt model/class_names25.txt
# !zip -r model25.zip model
# from google.colab import files
# files.download('model25.zip')
import matplotlib.pyplot as plt
import numpy as np
import random
%matplotlib inline
model25 = tf.keras.models.load_model('./model25/keras25.h5')
rand = np.floor(np.random.random((28,28)) + .5)
all_black = np.full((28,28, 3), 0)
all_white = np.ones((28,28))
diag = np.eye(28)
diag_low = np.eye(28, k=-15)
diag_high = np.eye(28, k=15)

plt.subplot(231)
plt.imshow(all_white, cmap='binary')
plt.subplot(232)
plt.imshow(rand, cmap='binary')
plt.subplot(233)
plt.imshow(all_black, cmap='binary')
plt.subplot(234)
plt.imshow(diag_low, cmap='binary')
plt.subplot(235)
plt.imshow(diag, cmap='binary')
plt.subplot(236)
plt.imshow(diag_high, cmap='binary')
first6 = cat_limit[:6]
first6
dummy_files = glob.glob(os.path.join('npy', '*.npy'))
dummy_data = []
for index, file in enumerate(dummy_files):
  test_data = np.load(file)
  dummy_data.append(test_data[:])<jupyter_output><empty_output><jupyter_text>You can change which category of doodles by changing the index number of dummy_data below.<jupyter_code>category_array = np.array(dummy_data[0])
category_array.shape<jupyter_output><empty_output><jupyter_text>Set up to take select a random image from the corresponding category and reshapes it so it is plot-able.Feel free to select your own index if you prefer.<jupyter_code>plot_me = category_array[random.randrange(len(category_array[0]))]
plot_me = plot_me.reshape(28,28)
plt.imshow(plot_me, cmap='binary')
butterfly = dummy_files[1]
butterfly_data = np.load(butterfly)
butterfly_data.shape
predict_me = plot_me.reshape(1,28,28,1)
prediction_single = model.predict(predict_me)
print(prediction_single)
np.argmax(prediction_single[0])<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14676616915422885, 'fraction_numerical': 0.03980099502487562, 'mean_word_length': 7.016611295681063, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '292301', 'license': 'MIT', 'n_tokens_mistral': 989, 'n_tokens_neox': 921, 'n_words': 181, 'path': 'model/notebooks/doodle2.ipynb', 'repo_name': 'ccchiang92/Doodles', 'size': '2412'}