<jupyter_start><jupyter_text>Entrenamiento del modelo<jupyter_code>training_stats = model.fit(train_X, train_Y, batch_size = 128, epochs = 12, verbose = 1, validation_data = (valid_X, valid_Y))

evaluation = model.evaluate(test_X, test_Y, verbose=0)

print('Test Set Evaluation: loss = %0.6f, accuracy = %0.2f' %(evaluation[0], 100 * evaluation[1]))

# We can plot our training statistics to see how it developed over time
accuracy, = graph.plot(training_stats.history['accuracy'], label = 'Accuracy')
training_loss, = graph.plot(training_stats.history['loss'], label = 'Training Loss')
graph.legend(handles = [accuracy, training_loss])
loss = np.array(training_stats.history['loss'])
xp = np.linspace(0,loss.shape[0],10 * loss.shape[0])
graph.plot(xp, np.full(xp.shape, 1), c = 'k', linestyle = ':', alpha = 0.5)
graph.plot(xp, np.full(xp.shape, 0), c = 'k', linestyle = ':', alpha = 0.5)
graph.show()<jupyter_output>Epoch 1/12
50/50 [==============================] - 10s 194ms/step - loss: 0.0538 - accuracy: 0.9839 - val_loss: 0.1067 - val_accuracy: 0.9644
Epoch 2/12
50/50 [==============================] - 10s 196ms/step - loss: 0.0454 - accuracy: 0.9878 - val_loss: 0.1043 - val_accuracy: 0.9688
Epoch 3/12
50/50 [==============================] - 8s 162ms/step - loss: 0.0404 - accuracy: 0.9887 - val_loss: 0.1046 - val_accuracy: 0.9688
Epoch 4/12
50/50 [==============================] - 10s 208ms/step - loss: 0.0357 - accuracy: 0.9908 - val_loss: 0.1078 - val_accuracy: 0.9669
Epoch 5/12
50/50 [==============================] - 9s 176ms/step - loss: 0.0347 - accuracy: 0.9898 - val_loss: 0.1016 - val_accuracy: 0.9656
Epoch 6/12
50/50 [==============================] - 9s 176ms/step - loss: 0.0262 - accuracy: 0.9922 - val_loss: 0.0939 - val_accuracy: 0.9706
Epoch 7/12
50/50 [==============================] - 9s 185ms/step - loss: 0.0248 - accuracy: 0.9937 - val_loss: 0.1013 - val_accuracy: 0.9688
Epo[...]<jupyter_text>Predicciones<jupyter_code># ANY NUMBER BETWEEN 0 AND 1999
sample = test_X[0].reshape(dim, dim)

graph.imshow(sample, cmap = 'gray', interpolation = 'nearest')
graph.show()

prediction = model.predict(sample.reshape(1, dim, dim, 1))
print('prediction: %i' %(np.argmax(prediction)))
sample = test_X[100].reshape(dim, dim)

graph.imshow(sample, cmap = 'gray', interpolation = 'nearest')
graph.show()

prediction = model.predict(sample.reshape(1, dim, dim, 1))
print('prediction: %i' %(np.argmax(prediction)))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.23907766990291263, 'fraction_numerical': 0.10517799352750809, 'mean_word_length': 5.017031630170316, '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': '333392', 'license': 'MIT', 'n_tokens_mistral': 1105, 'n_tokens_neox': 911, 'n_words': 206, 'path': 'Curso-de-iniciacion-sobre-aprendizaje-automatico/Uso-de-modelos-de-aprendizaje-profundo-para-realizar-predicciones-sobre-datos-especializados/redes_neuronales_convolucionales.ipynb', 'repo_name': 'josephLSalgado/IA-Innovaccion', 'size': '2472'}