<jupyter_start><jupyter_text>Predicting 3 every time would give us an accuracy of ~35% (3159/8982)<jupyter_code>predictions = model.predict(x_test[:5])
tf.argmax(predictions, axis=1)<jupyter_output><empty_output><jupyter_text>if we don't want to 1-hot the labels ... `sparse_categorical_crossentropy`<jupyter_code>y_train, y_test = [np.array(l) for l in [train_labels, test_labels]]
y_val = y_train[:1000]
partial_y_train = y_train[1000:]
model = keras.Sequential([
    keras.layers.Dense(64, activation='relu'),
    keras.layers.Dense(64, activation='relu'),
    keras.layers.Dense(46, activation='softmax')
])

model.compile(optimizer='rmsprop', loss='sparse_categorical_crossentropy', metrics=['accuracy'])

history = model.fit(
    partial_x_train,
    partial_y_train,
    batch_size=512,
    epochs=2,
    validation_data=[x_val, y_val]
)<jupyter_output>Epoch 1/2
16/16 [==============================] - 1s 46ms/step - loss: 2.6241 - accuracy: 0.5177 - val_loss: 1.7081 - val_accuracy: 0.6470
Epoch 2/2
16/16 [==============================] - 0s 29ms/step - loss: 1.3973 - accuracy: 0.7152 - val_loss: 1.2654 - val_accuracy: 0.7290
{'fraction_non_alphanumeric': 0.18964003511852504, 'fraction_numerical': 0.07901668129938542, 'mean_word_length': 5.551724137931035, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, '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': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '495162', 'license': 'Apache-2.0', 'n_tokens_mistral': 496, 'n_tokens_neox': 433, 'n_words': 79, 'path': '04.2_routers.ipynb', 'repo_name': 'pete88b/deep_learning_with_python', 'size': '1139'}