<jupyter_start><jupyter_text>shamelessly stolen fromhttp://machinelearningmastery.com/handwritten-digit-recognition-using-convolutional-neural-networks-python-keras/<jupyter_code>import matplotlib.pyplot as plt
import numpy as np
plt.subplot(221)
plt.imshow(x_test[0], cmap=plt.get_cmap('gray'))
plt.subplot(222)
plt.imshow(255- x_train[1], cmap=plt.get_cmap('gray'))
plt.subplot(223)
plt.imshow(x_train[2], cmap=plt.get_cmap('gray'))
plt.subplot(224)
plt.imshow(x_train[3], cmap=plt.get_cmap('gray'))
# show the plot
plt.show()

X_train = X_train / 255
X_test = X_test / 255
# one hot encode outputs
y_train = np_utils.to_categorical(y_train)
y_test = np_utils.to_categorical(y_test)
num_classes = y_test.shape[1]
def baseline_model():
    model = Sequential()
    model.add(Dense(60, input_shape=(784,), activation='relu'))
    model.add(Dense(8, activation='relu'))
    model.add(Dense(1, activation='sigmoid'))
	
    model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy'])
    return model
model = baseline_model()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1519925857275255, 'fraction_numerical': 0.030583873957367932, 'mean_word_length': 6.9411764705882355, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '609742', 'license': 'MIT', 'n_tokens_mistral': 451, 'n_tokens_neox': 416, 'n_words': 61, 'path': 'part2.ipynb', 'repo_name': 'mungobungo/deep', 'size': '1079'}