<jupyter_start><jupyter_text>Creating a Sequential model<jupyter_code>model = tf.keras.models.Sequential()
model.add(tf.keras.layers.Flatten(input_shape=[28, 28]))
model.add(tf.keras.layers.Dense(200, activation="relu"))
model.add(tf.keras.layers.Dense(100, activation="relu"))
model.add(tf.keras.layers.Dense(10, activation="softmax"))
 model.summary()
weights, biases = model.layers[2].get_weights()
weights
model.compile(loss=tf.keras.losses.sparse_categorical_crossentropy, 
              optimizer=tf.keras.optimizers.SGD(), 
              metrics=[tf.keras.metrics.sparse_categorical_accuracy])
history = model.fit(X_train, y_train, epochs=30, validation_data=(X_valid, y_valid))
pd.DataFrame(history.history).plot(figsize=(10, 6))
model.evaluate(X_test, y_test)<jupyter_output>313/313 [==============================] - 0s 2ms/step - loss: 14.9817 - sparse_categorical_accuracy: 0.9733
{'fraction_non_alphanumeric': 0.18161434977578475, 'fraction_numerical': 0.04147982062780269, 'mean_word_length': 6.504201680672269, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '313673', 'license': 'MIT', 'n_tokens_mistral': 353, 'n_tokens_neox': 318, 'n_words': 37, 'path': 'neural-networks/nn_mnist_classifier.ipynb', 'repo_name': 'VladiGGeorgiev/ml-playground', 'size': '892'}