diff --git a/proyectos/lunar-lander/Lunar_Lander.ipynb b/proyectos/lunar-lander/Lunar_Lander.ipynb index 12e7363..74dda03 100644 --- a/proyectos/lunar-lander/Lunar_Lander.ipynb +++ b/proyectos/lunar-lander/Lunar_Lander.ipynb @@ -1,33 +1,21 @@ { - "nbformat": 4, - "nbformat_minor": 0, - "metadata": { - "colab": { - "provenance": [], - "toc_visible": true - }, - "kernelspec": { - "name": "python3", - "display_name": "Python 3" - }, - "language_info": { - "name": "python" - } - }, "cells": [ { "cell_type": "markdown", + "metadata": { + "id": "hmWbGiyvNNME" + }, "source": [ "# LUNAR LANDER\n", "\n", "El objetivo del juego es simple (Β‘pero aterrizar no lo es!): Β‘aterrizar la nave espacial sana y salva en la plataforma designada! Β‘PrepΓ‘rate para un aterrizaje suave y heroico! πŸš€πŸŒ•\n" - ], - "metadata": { - "id": "hmWbGiyvNNME" - } + ] }, { "cell_type": "markdown", + "metadata": { + "id": "OvS3IEo_Pmv8" + }, "source": [ "## Reglas y Punteo\n", "En cada momento del juego, ganas o pierdes puntos (recompensa) dependiendo de cΓ³mo te vaya:\n", @@ -43,35 +31,83 @@ "**Final del juego**: Si te estrellas, pierdes **100** puntos. Si aterrizas suavemente en la plataforma, Β‘ganas **100** puntos extra!\n", "\n", "Para considerar que has tenido Γ©xito en un intento (episodio), Β‘necesitas conseguir al menos **200** puntos en total!" - ], - "metadata": { - "id": "OvS3IEo_Pmv8" - } + ] }, { "cell_type": "markdown", - "source": [ - "## Instalacion de librerias" - ], "metadata": { "id": "GiL_39bYC6dT" - } + }, + "source": [ + "## Instalacion de librerias" + ] }, { "cell_type": "markdown", - "source": [], "metadata": { "id": "Fg7rH6DJPneG" - } + }, + "source": [] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": { - "id": "isgdPYBPWrSE", - "collapsed": true + "collapsed": true, + "id": "isgdPYBPWrSE" }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Defaulting to user installation because normal site-packages is not writeable\n", + "Requirement already satisfied: gymnasium[other] in /home/vscode/.local/lib/python3.10/site-packages (1.2.1)\n", + "Requirement already satisfied: farama-notifications>=0.0.1 in /home/vscode/.local/lib/python3.10/site-packages (from gymnasium[other]) (0.0.4)\n", + "Requirement already satisfied: typing-extensions>=4.3.0 in /home/vscode/.local/lib/python3.10/site-packages (from gymnasium[other]) (4.15.0)\n", + "Requirement already satisfied: numpy>=1.21.0 in /home/vscode/.local/lib/python3.10/site-packages (from gymnasium[other]) (2.2.6)\n", + "Requirement already satisfied: cloudpickle>=1.2.0 in /home/vscode/.local/lib/python3.10/site-packages (from gymnasium[other]) (3.1.1)\n", + "Collecting seaborn>=0.13\n", + " Downloading seaborn-0.13.2-py3-none-any.whl (294 kB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m294.9/294.9 KB\u001b[0m \u001b[31m822.2 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n", + "\u001b[?25hRequirement already satisfied: matplotlib>=3.0 in /home/vscode/.local/lib/python3.10/site-packages (from gymnasium[other]) (3.10.6)\n", + "Collecting moviepy>=1.0.0\n", + " Downloading moviepy-2.2.1-py3-none-any.whl (129 kB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m129.9/129.9 KB\u001b[0m \u001b[31m5.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hCollecting opencv-python>=3.0\n", + " Downloading opencv_python-4.12.0.88-cp37-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl (45.9 MB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m45.9/45.9 MB\u001b[0m \u001b[31m24.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m00:01\u001b[0m\n", + "\u001b[?25hRequirement already satisfied: pillow>=8 in /home/vscode/.local/lib/python3.10/site-packages (from matplotlib>=3.0->gymnasium[other]) (11.3.0)\n", + "Requirement already satisfied: fonttools>=4.22.0 in /home/vscode/.local/lib/python3.10/site-packages (from matplotlib>=3.0->gymnasium[other]) (4.60.1)\n", + "Requirement already satisfied: cycler>=0.10 in /home/vscode/.local/lib/python3.10/site-packages (from matplotlib>=3.0->gymnasium[other]) (0.12.1)\n", + "Requirement already satisfied: pyparsing>=2.3.1 in /usr/lib/python3/dist-packages (from matplotlib>=3.0->gymnasium[other]) (2.4.7)\n", + "Requirement already satisfied: kiwisolver>=1.3.1 in /home/vscode/.local/lib/python3.10/site-packages (from matplotlib>=3.0->gymnasium[other]) (1.4.9)\n", + "Requirement already satisfied: packaging>=20.0 in /home/vscode/.local/lib/python3.10/site-packages (from matplotlib>=3.0->gymnasium[other]) (25.0)\n", + "Requirement already satisfied: python-dateutil>=2.7 in /home/vscode/.local/lib/python3.10/site-packages (from matplotlib>=3.0->gymnasium[other]) (2.9.0.post0)\n", + "Requirement already satisfied: contourpy>=1.0.1 in /home/vscode/.local/lib/python3.10/site-packages (from matplotlib>=3.0->gymnasium[other]) (1.3.2)\n", + "Collecting proglog<=1.0.0\n", + " Downloading proglog-0.1.12-py3-none-any.whl (6.3 kB)\n", + "Collecting imageio_ffmpeg>=0.2.0\n", + " Downloading imageio_ffmpeg-0.6.0-py3-none-manylinux2014_aarch64.whl (25.6 MB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m25.6/25.6 MB\u001b[0m \u001b[31m27.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m00:01\u001b[0m\n", + "\u001b[?25hRequirement already satisfied: decorator<6.0,>=4.0.2 in /home/vscode/.local/lib/python3.10/site-packages (from moviepy>=1.0.0->gymnasium[other]) (5.2.1)\n", + "Collecting imageio<3.0,>=2.5\n", + " Downloading imageio-2.37.0-py3-none-any.whl (315 kB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m315.8/315.8 KB\u001b[0m \u001b[31m26.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hCollecting python-dotenv>=0.10\n", + " Downloading python_dotenv-1.1.1-py3-none-any.whl (20 kB)\n", + "Requirement already satisfied: pandas>=1.2 in /home/vscode/.local/lib/python3.10/site-packages (from seaborn>=0.13->gymnasium[other]) (2.3.3)\n", + "Requirement already satisfied: tzdata>=2022.7 in /home/vscode/.local/lib/python3.10/site-packages (from pandas>=1.2->seaborn>=0.13->gymnasium[other]) (2025.2)\n", + "Requirement already satisfied: pytz>=2020.1 in /home/vscode/.local/lib/python3.10/site-packages (from pandas>=1.2->seaborn>=0.13->gymnasium[other]) (2025.2)\n", + "Collecting tqdm\n", + " Downloading tqdm-4.67.1-py3-none-any.whl (78 kB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m78.5/78.5 KB\u001b[0m \u001b[31m25.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hRequirement already satisfied: six>=1.5 in /usr/lib/python3/dist-packages (from python-dateutil>=2.7->matplotlib>=3.0->gymnasium[other]) (1.16.0)\n", + "Installing collected packages: tqdm, python-dotenv, opencv-python, imageio_ffmpeg, imageio, proglog, seaborn, moviepy\n", + "Successfully installed imageio-2.37.0 imageio_ffmpeg-0.6.0 moviepy-2.2.1 opencv-python-4.12.0.88 proglog-0.1.12 python-dotenv-1.1.1 seaborn-0.13.2 tqdm-4.67.1\n" + ] + } + ], "source": [ "# Permite conectar codigo en C, C++ con Python\n", "# Requerido por box2d\n", @@ -86,48 +122,127 @@ "!pip install -q pyvirtualdisplay\n", "\n", "# Agente DQN (Deep Q-learning), al que entrenaremos\n", - "!pip install -q stable-baselines3" + "!pip install -q stable-baselines3\n", + "# Instalamos TensorBoard para visualizar los logs de entrenamiento\n", + "!pip install -q tensorboard\n", + "# Instalando libreria para grabar videos de los entrenamientos\n", + "!pip install \"gymnasium[other]\"" ] }, { "cell_type": "markdown", - "source": [ - "## Variables globales" - ], "metadata": { "id": "3l9R8gV2C_ZJ" - } + }, + "source": [ + "## Variables globales" + ] }, { "cell_type": "code", + "execution_count": 2, + "metadata": { + "id": "502iTO5rCz_P" + }, + "outputs": [], "source": [ "ENV_NAME = \"LunarLander-v3\" # Nombre del entorno\n", "VIDEO_FOLDER = \"./video_prueba_de_vuelo\" # En esta carpeta se guardaran los videos del test de vuelo\n", "EPISODES = 1 # Numero de episodios a grabar en la prueba de vuelo, se tratara de seleccionar el mejor\n", "LOG_DIR = \"./tmp/dqn_lunar\" # Carpeta donde se guardarΓ‘n los registros de entrenamiento (logs)" - ], - "metadata": { - "id": "502iTO5rCz_P" - }, - "execution_count": null, - "outputs": [] + ] }, { "cell_type": "markdown", - "source": [ - "## Entrenando el modelo" - ], "metadata": { "id": "Ywk9QTWzEOtc" - } + }, + "source": [ + "## Entrenando el modelo" + ] }, { "cell_type": "code", + "execution_count": 8, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "collapsed": true, + "id": "OtROtkf7gzka", + "outputId": "2a034bad-4142-407d-8073-925de62cac5e" + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Using cpu device\n", + "\n", + "--- INICIANDO ENTRENAMIENTO DQN por 100000 pasos ---\n", + "Logging to ./tmp/dqn_lunar/DQN_3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "----------------------------------\n", + "| rollout/ | |\n", + "| ep_len_mean | 153 |\n", + "| ep_rew_mean | -256 |\n", + "| exploration_rate | 0.05 |\n", + "| time/ | |\n", + "| episodes | 100 |\n", + "| fps | 1983 |\n", + "| time_elapsed | 7 |\n", + "| total_timesteps | 15285 |\n", + "| train/ | |\n", + "| learning_rate | 0.0001 |\n", + "| loss | 4.4 |\n", + "| n_updates | 2571 |\n", + "----------------------------------\n", + "----------------------------------\n", + "| rollout/ | |\n", + "| ep_len_mean | 326 |\n", + "| ep_rew_mean | -85.8 |\n", + "| exploration_rate | 0.05 |\n", + "| time/ | |\n", + "| episodes | 200 |\n", + "| fps | 1439 |\n", + "| time_elapsed | 33 |\n", + "| total_timesteps | 47889 |\n", + "| train/ | |\n", + "| learning_rate | 0.0001 |\n", + "| loss | 1.73 |\n", + "| n_updates | 10722 |\n", + "----------------------------------\n", + "----------------------------------\n", + "| rollout/ | |\n", + "| ep_len_mean | 367 |\n", + "| ep_rew_mean | -50.4 |\n", + "| exploration_rate | 0.05 |\n", + "| time/ | |\n", + "| episodes | 300 |\n", + "| fps | 1384 |\n", + "| time_elapsed | 61 |\n", + "| total_timesteps | 84617 |\n", + "| train/ | |\n", + "| learning_rate | 0.0001 |\n", + "| loss | 1.17 |\n", + "| n_updates | 19904 |\n", + "----------------------------------\n", + "\n", + "--- ENTRENAMIENTO FINALIZADO. Modelo entrenado guardado. ---\n" + ] + } + ], "source": [ "# ==============================================================================\n", "# ENTRENAMIENTO DE UN AGENTE DQN (Stable-Baselines3)\n", "# ==============================================================================\n", "\n", + "\n", "# Gymnasium provee el entorno, controles y evalua el resultado\n", "import gymnasium as gym\n", "from gymnasium.wrappers import RecordVideo\n", @@ -191,126 +306,43 @@ "print(\"\\n--- ENTRENAMIENTO FINALIZADO. Modelo entrenado guardado. ---\")\n", "model.save(\"modelo_nave_entrenada\") # Guarda el modelo entrenado\n", "env_train.close()" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "collapsed": true, - "id": "OtROtkf7gzka", - "outputId": "2a034bad-4142-407d-8073-925de62cac5e" - }, - "execution_count": null, - "outputs": [ - { - "output_type": "stream", - "name": "stderr", - "text": [ - "Gym has been unmaintained since 2022 and does not support NumPy 2.0 amongst other critical functionality.\n", - "Please upgrade to Gymnasium, the maintained drop-in replacement of Gym, or contact the authors of your software and request that they upgrade.\n", - "See the migration guide at https://gymnasium.farama.org/introduction/migration_guide/ for additional information.\n", - ":488: DeprecationWarning: builtin type SwigPyPacked has no __module__ attribute\n", - ":488: DeprecationWarning: builtin type SwigPyObject has no __module__ attribute\n", - ":488: DeprecationWarning: builtin type swigvarlink has no __module__ attribute\n", - "/usr/local/lib/python3.12/dist-packages/pygame/pkgdata.py:25: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html\n", - " from pkg_resources import resource_stream, resource_exists\n", - "/usr/local/lib/python3.12/dist-packages/pkg_resources/__init__.py:3154: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('google')`.\n", - "Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages\n", - " declare_namespace(pkg)\n", - "/usr/local/lib/python3.12/dist-packages/pkg_resources/__init__.py:3154: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('google.cloud')`.\n", - "Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages\n", - " declare_namespace(pkg)\n", - "/usr/local/lib/python3.12/dist-packages/pkg_resources/__init__.py:3154: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('sphinxcontrib')`.\n", - "Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages\n", - " declare_namespace(pkg)\n", - "/usr/local/lib/python3.12/dist-packages/jupyter_client/session.py:203: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).\n", - " return datetime.utcnow().replace(tzinfo=utc)\n" - ] - }, - { - "output_type": "stream", - "name": "stdout", - "text": [ - "Using cpu device\n" - ] - }, - { - "output_type": "stream", - "name": "stderr", - "text": [ - "/usr/local/lib/python3.12/dist-packages/jupyter_client/session.py:203: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).\n", - " return datetime.utcnow().replace(tzinfo=utc)\n" - ] - }, - { - "output_type": "stream", - "name": "stdout", - "text": [ - "\n", - "--- INICIANDO ENTRENAMIENTO DQN por 100000 pasos ---\n", - "Logging to ./tmp/dqn_lunar/DQN_4\n", - "----------------------------------\n", - "| rollout/ | |\n", - "| ep_len_mean | 213 |\n", - "| ep_rew_mean | -241 |\n", - "| exploration_rate | 0.05 |\n", - "| time/ | |\n", - "| episodes | 100 |\n", - "| fps | 990 |\n", - "| time_elapsed | 21 |\n", - "| total_timesteps | 21324 |\n", - "| train/ | |\n", - "| learning_rate | 0.0001 |\n", - "| loss | 1.19 |\n", - "| n_updates | 4080 |\n", - "----------------------------------\n", - "----------------------------------\n", - "| rollout/ | |\n", - "| ep_len_mean | 318 |\n", - "| ep_rew_mean | -111 |\n", - "| exploration_rate | 0.05 |\n", - "| time/ | |\n", - "| episodes | 200 |\n", - "| fps | 858 |\n", - "| time_elapsed | 61 |\n", - "| total_timesteps | 53093 |\n", - "| train/ | |\n", - "| learning_rate | 0.0001 |\n", - "| loss | 0.729 |\n", - "| n_updates | 12023 |\n", - "----------------------------------\n", - "----------------------------------\n", - "| rollout/ | |\n", - "| ep_len_mean | 315 |\n", - "| ep_rew_mean | 8.29 |\n", - "| exploration_rate | 0.05 |\n", - "| time/ | |\n", - "| episodes | 300 |\n", - "| fps | 832 |\n", - "| time_elapsed | 101 |\n", - "| total_timesteps | 84629 |\n", - "| train/ | |\n", - "| learning_rate | 0.0001 |\n", - "| loss | 1.27 |\n", - "| n_updates | 19907 |\n", - "----------------------------------\n", - "\n", - "--- ENTRENAMIENTO FINALIZADO. Modelo entrenado guardado. ---\n" - ] - } ] }, { "cell_type": "markdown", - "source": [ - "## Prueba de Vuelo" - ], "metadata": { "id": "nq6619RPJBFb" - } + }, + "source": [ + "## Prueba de Vuelo" + ] }, { "cell_type": "code", + "execution_count": 13, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "jL7FmdKqhZaA", + "outputId": "faeee27a-cb52-472a-cde7-47828f328b1f" + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "--- Configurando Pantalla Virtual ---\n", + "Advertencia al iniciar pyvirtualdisplay: [Errno 2] No such file or directory: 'Xvfb'. Continuaremos.\n", + "Grabando 1 episodio(s) en la carpeta: ./video_prueba_de_vuelo\n", + "Wrapping the env with a `Monitor` wrapper\n", + "Wrapping the env in a DummyVecEnv.\n", + "\n", + "--- GrabaciΓ³n del video finalizada. ---\n" + ] + } + ], "source": [ "# ==============================================================================\n", "# 4. PRUEBA DE VUELO Y GRABAR EL VIDEO\n", @@ -372,43 +404,56 @@ "\n", "env_test_video.close()\n", "print(\"\\n--- GrabaciΓ³n del video finalizada. ---\")" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "jL7FmdKqhZaA", - "outputId": "faeee27a-cb52-472a-cde7-47828f328b1f" - }, - "execution_count": null, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "\n", - "--- Configurando Pantalla Virtual ---\n", - "Pantalla virtual iniciada.\n", - "Grabando 1 episodio(s) en la carpeta: ./video_prueba_de_vuelo\n", - "Wrapping the env with a `Monitor` wrapper\n", - "Wrapping the env in a DummyVecEnv.\n", - "\n", - "--- GrabaciΓ³n del video finalizada. ---\n" - ] - } ] }, { "cell_type": "markdown", - "source": [ - "## Reproducir Video de la prueba" - ], "metadata": { "id": "ZYI_XlxDJJU4" - } + }, + "source": [ + "## Reproducir Video de la prueba" + ] }, { "cell_type": "code", + "execution_count": 14, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 485 + }, + "id": "VAqKRsjN2gb-", + "outputId": "7b7f43cc-af29-4f29-edcc-34345da691db" + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "βœ… Se encontraron 1 videos para reproducir.\n", + "Mostrando: ./video_prueba_de_vuelo/prueba_de_vuelo-episode-0.mp4\n" + ] + }, + { + "data": { + "text/html": [ + "\n", + " \n", + "

--------------------------------------------------

\n", + " " + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "# ==============================================================================\n", "# 5. CARGAR Y REPRODUCIR EL VIDEO DE LA PRUEBA DE VUELO\n", @@ -459,56 +504,40 @@ " display_encoded_video(video_file)\n", "else:\n", " print(f\"❌ No se encontrΓ³ ningΓΊn archivo de video MP4 en {VIDEO_FOLDER}.\")" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/", - "height": 485 - }, - "id": "VAqKRsjN2gb-", - "outputId": "7b7f43cc-af29-4f29-edcc-34345da691db" - }, - "execution_count": null, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "βœ… Se encontraron 1 videos para reproducir.\n", - "Mostrando: ./video_prueba_de_vuelo/prueba_de_vuelo-episode-0.mp4\n" - ] - }, - { - "output_type": "display_data", - "data": { - "text/plain": [ - "" - ], - "text/html": [ - "\n", - " \n", - "

--------------------------------------------------

\n", - " " - ] - }, - "metadata": {} - } ] }, { "cell_type": "markdown", - "source": [ - "## Puntaje de la prueba" - ], "metadata": { "id": "za-H_n-3JRBd" - } + }, + "source": [ + "## Puntaje de la prueba" + ] }, { "cell_type": "code", + "execution_count": 15, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 211 + }, + "id": "uabPapxG2_nO", + "outputId": "bc9ac42e-9bf3-4653-c4e9-bb6c063c6d2a" + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Reward (Recompensa): 2.16\n", + "Done (Logro Completar?): False\n", + "Truncated (Tuvo que interrumpirse?): True\n", + "Info (InformaciΓ³n): {}\n" + ] + } + ], "source": [ "# ----------------------------------------------------------------------\n", "# CALIFICACION DEL ENTRENAMIENTO\n", @@ -523,29 +552,31 @@ "print(f\"Done (Logro Completar?): {done}\")\n", "print(f\"Truncated (Tuvo que interrumpirse?): {truncated}\")\n", "print(f\"Info (InformaciΓ³n): {info}\")" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/", - "height": 211 - }, - "id": "uabPapxG2_nO", - "outputId": "bc9ac42e-9bf3-4653-c4e9-bb6c063c6d2a" - }, - "execution_count": null, - "outputs": [ - { - "output_type": "error", - "ename": "NameError", - "evalue": "name 'reward' is not defined", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m/tmp/ipython-input-984683751.py\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0;31m# Imprimir cada variable en una lΓ­nea separada\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 10\u001b[0;31m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34mf\"Reward (Recompensa): {reward:.2f}\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 11\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34mf\"Done (Logro Completar?): {done}\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 12\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34mf\"Truncated (Tuvo que interrumpirse?): {truncated}\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;31mNameError\u001b[0m: name 'reward' is not defined" - ] - } ] } - ] -} \ No newline at end of file + ], + "metadata": { + "colab": { + "provenance": [], + "toc_visible": true + }, + "kernelspec": { + "display_name": "Python 3", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.10.12" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +}