From 3334d70e438205055e77ce2219f77b58f7bc862d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luc=C3=ADa=20Bel=C3=A9n?= Date: Wed, 18 Dec 2024 17:44:36 +0000 Subject: [PATCH] Created spanish version of the excercices on file problems.es.ipynb --- notebook/problems.es.ipynb | 755 +++++++++++++++++++++++++++++++++++++ 1 file changed, 755 insertions(+) create mode 100644 notebook/problems.es.ipynb diff --git a/notebook/problems.es.ipynb b/notebook/problems.es.ipynb new file mode 100644 index 00000000..5ced765e --- /dev/null +++ b/notebook/problems.es.ipynb @@ -0,0 +1,755 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "5dbe7b9e", + "metadata": {}, + "source": [ + "# Problemas de Cálculo y Álgebra" + ] + }, + { + "cell_type": "markdown", + "id": "519c4b12", + "metadata": {}, + "source": [ + "## Cálculo\n", + "\n", + "El cálculo no es algo oscuro. Es el lenguaje para modelar comportamientos. El cálculo nos permite encontrar la tasa de cambios para optimizar una función. Sin el cálculo, no podríamos comprender completamente técnicas como\n", + "\n", + "Retropropagación en redes neuronales\n", + "\n", + "Regresión utilizando mínimos cuadrados óptimos\n", + "\n", + "Maximización de la expectativa en el ajuste de modelos probabilísticos" + ] + }, + { + "cell_type": "markdown", + "id": "b7e2e87a", + "metadata": {}, + "source": [ + "### Ejercicio 1\n", + "\n", + "Supongamos que, en mi oficina, me toma 10 segundos (tiempo) recorrer 25 metros (distancia) hasta la máquina de café.\n", + "Si queremos expresar la situación anterior como una función, sería:\n", + "\n", + "distancia=velocidad×tiempo\n", + "\n", + "Por lo tanto, en este caso, la velocidad es la primera derivada de la función de distancia mencionada. Dado que la velocidad describe la tasa de cambio de la distancia con respecto al tiempo, cuando las personas dicen que toman la primera derivada de una función determinada, se refieren a encontrar la tasa de cambio de esa función.\n", + "\n", + "**Encuentra la velocidad y construye la función lineal de la distancia $(d)$ con respecto al tiempo $(t)$, cuando $(t ∈ [0,10])$.**" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "bb3e954e", + "metadata": {}, + "outputs": [], + "source": [ + "# importa las librerías\n", + "\n", + "\n", + "# Define la función de distancia" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "dbc4c780", + "metadata": {}, + "outputs": [], + "source": [ + "# \"Graficar la función de distancia en el dominio (t)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4c4d4f20", + "metadata": {}, + "outputs": [], + "source": [ + "# Crea un DataFrame" + ] + }, + { + "cell_type": "markdown", + "id": "1144168d", + "metadata": {}, + "source": [ + "### Ejercicio 2\n", + "\n", + "Resultó que no caminaba a una velocidad constante hacia la máquina de café, sino que estaba acelerando (mi velocidad aumentaba con el tiempo). Si mi velocidad inicial era 0, todavía me tomó 10 segundos viajar desde mi asiento hasta la máquina de café, pero caminaba cada vez más rápido.\n", + "\n", + "$V_o$ = velocidad inicial = $0$\n", + "\n", + "t = tiempo\n", + "\n", + "a = aceleración\n", + "\n", + "**distancia** = $V_o * t + 0.5 * a * (t^2)$\n", + "\n", + "**velocidad** = $V_o + a * t$\n", + "\n", + "La primera derivada de la función de velocidad es la aceleración. Me doy cuenta de que la función de velocidad está estrechamente relacionada con la función de distancia.\n", + "\n", + "**Encuentra el valor de la aceleración y construye la función cuadrática para $(t ∈ [0,10])$. Además, crea un gráfico y una tabla.**" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ec1f8bd7", + "metadata": {}, + "outputs": [], + "source": [ + "# Define y grafica la función cuadrática" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ba5c497b", + "metadata": {}, + "outputs": [], + "source": [ + "# Crea un DataFrame" + ] + }, + { + "cell_type": "markdown", + "id": "66d4cc18", + "metadata": {}, + "source": [ + "Antes del ejercicio 3, haremos una breve introducción al algoritmo de Descenso por Gradientes, el cual tendrá una explicación más detallada en módulos futuros del bootcamp.\n", + "\n", + "El algoritmo de Descenso por Gradientes es el héroe detrás de la familia de algoritmos de aprendizaje profundo. Cuando un algoritmo de esta familia se ejecuta, intenta minimizar el error entre la entrada de entrenamiento y la salida predicha. Esta minimización se realiza mediante algoritmos de optimización, y el descenso por gradientes es el más popular.\n", + "\n", + "Supongamos que tienes estos pares de entrada y salida:\n", + "\n", + "```py\n", + "# Entrada:\n", + "[\n", + " [1,2],\n", + " [3,4]\n", + "]\n", + "\n", + "# Salida:\n", + "[\n", + " [50],\n", + " [110]\n", + "]\n", + "```\n", + "\n", + "Podemos estimar que si multiplicamos los valores de entrada por [10, 20], podemos obtener la salida como se muestra arriba.\n", + "\n", + "```py\n", + "1(10) + 2(20) = 50\n", + "\n", + "3(10) + 4(20) = 110\n", + "```\n", + "\n", + "Cuando un algoritmo de aprendizaje automático comienza a ejecutarse, asigna valores aleatorios y hace una predicción.\n", + "Supongamos que asignó los valores [1,2]:\n", + "\n", + "```py\n", + "1(1) + 2(2) = 5\n", + "\n", + "3(1) + 4(2) = 11\n", + "```\n", + "\n", + "Una vez que tiene las predicciones, calcula el error: la diferencia entre los datos reales y los datos predichos. Existen muchas formas de calcular el error, y se les llama funciones de pérdida.\n", + "\n", + "Una vez que tenemos este valor, el algoritmo de optimización comienza a mostrar su funcionamiento, y establece nuevos valores que reemplazan a los valores aleatorios iniciales.\n", + "\n", + "Y el ciclo continúa hasta que se cumple una condición. Esa condición puede ser hacer el ciclo n veces, o hacerlo hasta que el error sea menor que un valor determinado." + ] + }, + { + "cell_type": "markdown", + "id": "85ef2f0b", + "metadata": {}, + "source": [ + "Puede ser difícil entender descenso por gradientes sin comprender gradiente. Así que, vamos a centrarnos en lo que es un gradiente. El gradiente muestra la dirección del mayor cambio de una función escalar. El cálculo del gradiente se realiza con derivadas, así que empecemos con un ejemplo sencillo. Para calcular el gradiente, solo necesitamos recordar algunos cálculos de álgebra lineal de la escuela secundaria porque necesitamos calcular derivadas.\n", + "\n", + "Supongamos que queremos encontrar el punto mínimo de $f(x) = x^2$. La derivada de esa función es $df(x)=2x$. \n", + "\n", + "El gradiente de $f(x)$ en el punto $x=-10$\n", + "\n", + "es \n", + "\n", + "$df(-10)=-20$.\n", + "\n", + "El gradiente de $f(x)$ en el punto $x=1$\n", + "\n", + "es \n", + "\n", + "$df(1)=2$.\n", + "\n", + "Ahora visualicemos $f(x)$ y esos puntos $x=-10$ y $x=1$ ." + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "id": "4ff7e11a", + "metadata": {}, + "outputs": [], + "source": [ + "import numpy as np\n", + "import seaborn as sns\n", + "\n", + "def f(x):\n", + " return x**2\n", + "\n", + "def df(x):\n", + " return 2*x\n", + "\n", + "def visualize(f, x=None):\n", + " \n", + " xArray = np.linspace(-10, 10, 100) \n", + " yArray = f(xArray)\n", + " sns.lineplot(x=xArray, y=yArray)\n", + " \n", + " if x is not None:\n", + " assert type(x) in [np.ndarray, list] # x debería ser un array de numpy o una lista\n", + " if type(x) is list: # Si es una lista, convertir en un array de numpy\n", + " x = np.array(x)\n", + "\n", + " \n", + " y = f(x)\n", + " sns.scatterplot(x=x, y=y, color='red')" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "id": "633a54fd", + "metadata": {}, + "outputs": [ + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD4CAYAAAAXUaZHAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAAsZ0lEQVR4nO3dd3xV9f3H8dcne5AESAIJZBES2SAYNuJAUdGKAxUHUBeOaum0Wtva2tqf4/drtVW04MSJIoobFzgQkIS9EyAhgSQkBLJ3vr8/7qWNaQJZ9547Ps/HI4/cnHuS8865lzcnZ3yPGGNQSinlWXysDqCUUqr7abkrpZQH0nJXSikPpOWulFIeSMtdKaU8kJ/VAQCioqJMUlKS1TGUUsqtZGRkFBtjolt7ziXKPSkpifT0dKtjKKWUWxGRnLae090ySinlgbTclVLKA2m5K6WUB9JyV0opD6TlrpRSHuiU5S4iz4v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++YiIvINtl0CX/lG0d92JyGLgg1aecshNzduxvn4MXAJMM/adja38jG5fX61oz+9/Yp48++scge295VAi4o+t2F81xixv+XzzsjfGfCQiC0Ukyhjj0AGy2vG6OOQ91U4XARuNMYUtn7BqfTVTKCKxxph8+26qI63McwjbsYET4rAdb+wQd98t8x4w234mwwBs/wN/33wGe2msAmbZJ80DHPWXwHnAbmNMXmtPikioiISdeIztoOL21ubtLi32c17exvKcflNzEbkQuAe41BhT1cY8zlpf7fn938P23gHbe+nLtv5D6i72ffrPAbuMMX9rY56YE/v+RWQctn/TDv1Pp52vy3vAXPtZMxOA0ma7Ixytzb+erVhfLTR/H7XVRSuB6SLSy74bdbp9Wsc446hxVz+wlVIeUAsUAiubPXc/tjMd9gAXNZv+EdDP/jgZW+lnAW8BgQ7K+SJwe4tp/YCPmuXYYv/YgW33hKPX3cvANmCr/Y0V2zKX/esZ2M7G2OekXFnY9itutn880zKXM9dXa78/8CC2/3wAguzvnSz7eynZCetoCrbdaVubracZwO0n3mfAXfZ1swXbgelJTsjV6uvSIpcAT9nX5zaaneXm4Gyh2Mo6otk0S9YXtv9g8oF6e3/djO04zRdAJvA50Ns+bxrwbLPvvcn+XssCbuzM8nX4AaWU8kDuvltGKaVUK7TclVLKA2m5K6WUB9JyV0opD6TlrpRSHkjLXSmlPJCWu1JKeaD/B3b+rZgWEmX9AAAAAElFTkSuQmCC", + "text/plain": [ + "
" + ] + }, + "metadata": { + "needs_background": "light" + }, + "output_type": "display_data" + } + ], + "source": [ + "visualize(f, x=[-10, 1])" + ] + }, + { + "cell_type": "markdown", + "id": "9c187ad7", + "metadata": {}, + "source": [ + "El punto rojo en x=-10 no conoce la superficie sobre la que se encuentra, solo sabe las coordenadas del lugar donde está y su propio gradiente, que es -20. Y el otro punto rojo en x=1 no sabe la superficie en la que se encuentra; solo sabe las coordenadas de su posición y su gradiente, que es 2.\n", + "\n", + "Con solo esta información, podemos decir que el punto rojo en x=-10 debería hacer un salto mayor que el de x=1 porque tiene un valor absoluto de gradiente mayor. El signo indica la dirección. El signo negativo (-) indica que el punto rojo en x=-10 debe moverse hacia la derecha, mientras que el otro debe moverse hacia la izquierda.\n", + "\n", + "En resumen, el punto rojo en x=-10 (gradient: -20) debería hacer un salto más grande hacia la derecha, y el punto rojo en x=1 (gradient: 2) debería hacer un salto más pequeño hacia la izquierda. \n", + "\n", + "Sabemos que la longitud del salto debería ser proporcional al gradiente, pero ¿cuál es exactamente ese valor? No lo sabemos. Así que, digamos que los puntos rojos deben moverse con una longitud de alpha * gradiente, donde alpha es solo un parámetro.\n", + "\n", + "Podemos decir que la nueva ubicación del punto rojo debe calcularse con la siguiente fórmula:\n", + "\n", + "x = x - gradient * alpha" + ] + }, + { + "cell_type": "markdown", + "id": "0a7f5c3f", + "metadata": {}, + "source": [ + "Ahora implementemos esto con **NumPy**. Comencemos visualizando la función $f(x)=x^2$ y el punto $x=-10$." + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "id": "e26dbdf0", + "metadata": {}, + "outputs": [ + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD4CAYAAAAXUaZHAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAAsFElEQVR4nO3dd3yV9d3/8dcne5AESEISyCIkMmUZNuLAiVYcqDiA4tZq7bRa29vW1v4c991qq2jBBU4UUdy4wIGAJOydMEISkpAQyN75/v44hzZNE8g65zrj83w8eOTkOldyvXOdwztXrvG9xBiDUkopz+JjdQCllFI9T8tdKaU8kJa7Ukp5IC13pZTyQFruSinlgfysDgAQFRVlkpOTrY6hlFJuJTMzs8QYE93Wcy5R7snJyWRkZFgdQyml3IqI5LT3nO6WUUopD6TlrpRSHkjLXSmlPJCWu1JKeSAtd6WU8kCnLHcReVFEjojI9hbT+orI5yKSZf/Yxz5dROTvIpItIltFZKzDkjc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VBFwMbjTFFrZ+wan21UCQiccaYAvtuqiNtzJOP7djACfHYjjd2irvvlnkfmG0/k2Egtt/AP7ScwV4aq4BZ9knzAEf9JXAesNsYk9fWkyISKiJhJx5jO6i4va15e0qr/ZxXtLM8p9/UXEQuAu4DLjPGVLczj7PWV0d+/vexvXfA9l76qr1fSD3Fvk//BWCXMeav7cwTe2Lfv4iMx/Z/2qG/dDr4urwPzLWfNTMRKGuxO8LR2v3r2Yr11UrL91F7XbQSuEBE+th3o15gn9Y5zjhq3N1/2EopD6gDioCVLZ57ENuZDnuAi1tM/xjob3+cgq30s4G3gUAH5XwZuKPVtP7Axy1ybLH/24Ft94Sj190rwDZgq/2NFdc6l/3zGdjOxtjnpFzZ2PYrbrb/e651Lmeur7Z+fuBhbL98AILs751s+3spxQnraCq23WlbW6ynGcAdJ95nwN32dbMF24HpyU7I1ebr0iqXAM/Y1+c2Wpzl5uBsodjKOqLFNEvWF7ZfMAVAg72/bsZ2nOZLIAv4AuhrnzcdeL7F195kf69lA/O7snwdfkAppTyQu++WUUop1QYtd6WU8kBa7kop5YG03JVSygNpuSullAfScldKKQ+k5a6UUh7o/wMz5ZLhDml7oAAAAABJRU5ErkJggg==", + "text/plain": [ + "
" + ] + }, + "metadata": { + "needs_background": "light" + }, + "output_type": "display_data" + } + ], + "source": [ + "visualize(f, x=[-10])" + ] + }, + { + "cell_type": "markdown", + "id": "6e752e19", + "metadata": {}, + "source": [ + "El siguiente código implementa toda la lógica explicada anteriormente:" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "id": "2bdd54f1", + "metadata": {}, + "outputs": [], + "source": [ + "def gradient_descent(x, nsteps=1):\n", + " \n", + " # collectXs es un array para almacenar cómo cambió x en cada iteración, para poder visualizarlo más tarde\n", + " \n", + " collectXs = [x]\n", + " \n", + " # learning_rate es el valor que mencionamos como alpha en la sección anterior\n", + " \n", + " learning_rate = 1e-01\n", + " \n", + " for _ in range(nsteps):\n", + " \n", + " # La siguiente línea hace la verdadera magia\n", + " # El siguiente valor de x se calcula restando el gradiente * learning_rate de sí mismo\n", + " # La intuición detrás de esta línea está en la sección anterior\n", + " \n", + " x -= df(x) * learning_rate \n", + " collectXs.append(x)\n", + " \n", + " # Retornamos una tupla que contiene\n", + " # x -> el valor reciente de x después de nsteps \n", + " # collectXs -> todos los valores de x que se calcularon hasta ahora\n", + " \n", + " return x, collectXs\n" + ] + }, + { + "cell_type": "markdown", + "id": "aea74a65", + "metadata": {}, + "source": [ + "Antes de ejecutar un descenso por gradientes con 1000 pasos, ejecutémoslo solo dos veces, un paso a la vez, para ver cómo evoluciona x. \n", + "Comenzamos con x=-10, y evoluciona a x=-8.Sabemos que cuando x=0 ese es el **punto mínimo**, así que sí, está evolucionando en la dirección correcta." + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "id": "0350981e", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "-8.0\n" + ] + } + ], + "source": [ + "x=-10\n", + "x, collectedXs = gradient_descent(x, nsteps=1)\n", + "print(x)" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "id": "f8e01e2d", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "-6.4\n" + ] + } + ], + "source": [ + "# El siguiente paso comenzará en at x=-8. Ejecutemos un descenso por gradientes durante 1 paso.\n", + "\n", + "x, collectedXs = gradient_descent(x, nsteps=1)\n", + "print(x)" + ] + }, + { + "cell_type": "markdown", + "id": "93f13b32", + "metadata": {}, + "source": [ + "Llega a 𝑥=−6.4. Excelente. Ahora, ejecutémoslo 1000 veces." + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "id": "b699d1fb", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "-7.873484301831169e-97\n" + ] + } + ], + "source": [ + "x, collectedXs = gradient_descent(x, nsteps=1000)\n", + "print(x)" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "id": "0b76ee22", + "metadata": {}, + "outputs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xMvasxj3Ccx/ErpbWlydXrD7bBmVef3YqcCwM3yPXMvXQqXUZ5i7BLr0n6K9x04p9RbwZStPWWVR83Ycr98AVwGTtKWzsZXv0e3HqxXt+flPb5NjeZ+DMH+2rEop5YG5sH+gtV7R8vnmxV5rvVop9ZpSqpfW2qoTZLXjfbHKZ6qdpgA7tNYFLZ8w6ng1U6CUCtda51m6qQpb2SYX87mB0yIxn2/sEEfvllkFzLCMZIjD/Bt4a/MNLEXje+BGy0OzAWv9JTAZOKi1zmntSaWUn1Iq4PRtzCcVU1vbtru06Oe8vo39bQMSlXlUkSfmP2lXWTnX5cCjwDVa66o2trHV8WrPz78K82cHzJ+l79r6hdRdLH36bwMHtNYvtbFNn9N9/0qpEZj/T1v1l04735dVwCzLqJlRQFmz7ghra/OvZyOOVwvNP0dt1aK1wKVKqR6WbtRLLY91jC3OGnf1H+ailAPUAgXA2mbPPYl5pEMaMKXZ46uBvpbb8ZiLfgawHPCyUs73gLtbPNYXWN0sx27Lv32YuyesfeyWAHuBPZYPVnjLXJb7V2AejXHYRrkyMPcr7rL8e71lLlser9Z+fuAZzL98ALwtn50My2cp3gbHaBzm7rQ9zY7TFcDdpz9nwP2WY7Mb84npMTbI1er70iKXAl61HM+9NBvlZuVsfpiLdVCzxww5Xph/weQB9Zb6NQfzeZr1QDrwLRBi2TYZWNjstXdYPmsZwO2d2b9MPyCEEE7I0btlhBBCtEKKuxBCOCEp7kII4YSkuAshhBOS4i6EEE5IirsQQjghKe5CCOGE/j/eVbP6E9guuQAAAABJRU5ErkJggg==", + "text/plain": [ + "
" + ] + }, + "metadata": { + "needs_background": "light" + }, + "output_type": "display_data" + } + ], + "source": [ + "visualize(f, x=collectedXs)" + ] + }, + { + "cell_type": "markdown", + "id": "d00d2fbb", + "metadata": {}, + "source": [ + "### Ejercicio 3\n", + "\n", + "Cuando llego a la máquina de café, escucho a mi colega hablar sobre los costos unitarios de producir el 'producto B' para la empresa. A medida que la empresa produce más unidades, los costos unitarios continúan disminuyendo hasta un punto en el que comienzan a aumentar.\n", + "\n", + "Para optimizar el costo de producción por unidad en su mínimo y mejorar la eficiencia, la empresa necesitaría encontrar el número de unidades que deben producirse donde los costos unitarios de producción comienzan a cambiar de disminuir a aumentar.\n", + "\n", + "**Construye la función cuadrática $f(x)=0.1(x)^2−9x +4500$ en $x∈[0,100]$ para crear la función de costo por unidad, y haz una conclusión.**" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7c67d8b7", + "metadata": {}, + "outputs": [], + "source": [ + "# Definir y graficar la función" + ] + }, + { + "cell_type": "markdown", + "id": "fbe54895", + "metadata": {}, + "source": [ + "Vimos con el Descenso por Gradientes cómo el punto rojo navega en un entorno que no conoce. Solo sabe las coordenadas de donde está y su gradiente. El punto rojo podría encontrar el punto mínimo usando solo este conocimiento y el algoritmo de descenso por gradientes.\n", + "\n", + "**Opcional**:\n", + "\n", + "Implementa todos los pasos anteriores para crear un algoritmo de descenso por gradientes y ver cómo evoluciona el costo por unidad, comenzando desde 0 unidades de producción." + ] + }, + { + "cell_type": "markdown", + "id": "aabad82c", + "metadata": {}, + "source": [ + "## Álgebra lineal" + ] + }, + { + "cell_type": "markdown", + "id": "6753636d", + "metadata": {}, + "source": [ + "### Ejercicio 1: Suma de dos matrices\n", + "\n", + "Supón que tenemos dos matrices A y B.\n", + "\n", + "```py\n", + "A = [[1,2],[3,4]]\n", + "B = [[4,5],[6,7]]\n", + "\n", + "luego tenemos\n", + "A+B = [[5,7],[9,11]]\n", + "A-B = [[-3,-3],[-3,-3]]\n", + "```\n", + "\n", + "Suma ambas matrices usando Python con NumPy." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9e200c32", + "metadata": {}, + "outputs": [], + "source": [ + "# import numpy as np\n", + "\n", + " \n", + " \n", + "# Crear la primera matriz\n", + "\n", + " \n", + "# Crear la segunda matriz\n", + "\n", + " \n", + "# Imprimir elementos\n", + "\n", + " \n", + "# Sumar ambas matrices\n" + ] + }, + { + "cell_type": "markdown", + "id": "93bfb6cc", + "metadata": {}, + "source": [ + "### Ejercicio 2: Suma de dos listas\n", + "\n", + "Habrá muchas situaciones en las que tendremos que encontrar una suma por índice de dos listas diferentes. Esto puede tener aplicaciones posibles en la programación diaria. En este ejercicio, resolveremos el mismo problema de varias maneras en las que se puede realizar esta tarea.\n", + "\n", + "Tenemos las siguientes dos listas:\n", + "\n", + "```py\n", + "list1 = [2, 5, 4, 7, 3]\n", + "list2 = [1, 4, 6, 9, 10]\n", + "```\n", + "\n", + "Ahora, usemos código en Python para demostrar la suma de dos listas." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "867b70fc", + "metadata": {}, + "outputs": [], + "source": [ + "# Naive method\n", + "\n", + "# Inicializando listas\n", + "list1 = [2, 5, 4, 7, 3]\n", + "list2 = [1, 4, 6, 9, 10]\n", + " \n", + "# Imprimir listas originales\n", + "print (\"Original list 1 : \" + str(list1))\n", + "print (\"Original list 2 : \" + str(list2))\n", + " \n", + "# Usando método ingenuo para sumar dos listas\n", + "res_list = []\n", + "for i in range(0, len(list1)):\n", + " res_list.append(list1[i] + list2[i])\n", + " \n", + "# Imprimir lista resultante\n", + "print (\"Resulting list is : \" + str(res_list))" + ] + }, + { + "cell_type": "markdown", + "id": "7a063d7f", + "metadata": {}, + "source": [ + "Ahora usa los siguientes tres métodos diferentes para realizar el mismo cálculo: suma de dos listas." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "681930a3", + "metadata": {}, + "outputs": [], + "source": [ + "# Usar comprensión de listas para realizar la suma de las dos listas:\n", + "\n", + "\n", + "# Inicializando listas\n", + "\n", + " \n", + "# Imprimir listas originales\n", + "\n", + " \n", + "# Usando comprensión de listas para sumar dos listas\n", + "\n", + " \n", + "# Imprimir lista resultante\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a3a8a425", + "metadata": {}, + "outputs": [], + "source": [ + "# Usar map() + add():\n", + "\n", + "\n", + "# Inicializando listas\n", + "\n", + " \n", + "# Imprimir listas originales\n", + "\n", + " \n", + "# Usando map() + add() para sumar dos listas\n", + "\n", + " \n", + "# Imprimir lista resultante" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1708d7ee", + "metadata": {}, + "outputs": [], + "source": [ + "# Usar zip() + sum():\n", + "\n", + "\n", + "# Inicializando listas\n", + "\n", + " \n", + "# Imprimir listas originales\n", + "\n", + " \n", + "# Usando zip() + sum() para sumar dos listas\n", + "\n", + " \n", + "# Imprimir lista resultante" + ] + }, + { + "cell_type": "markdown", + "id": "1aef1bd2", + "metadata": {}, + "source": [ + "### Ejercicio 3: Multiplicación punto a punto\n", + "\n", + "Tenemos dos matrices:\n", + "\n", + "```py\n", + "matrix1 = [[1,7,3],\n", + " [4,5,2],\n", + " [3,6,1]]\n", + "matrix2 = [[5,4,1],\n", + " [1,2,3],\n", + " [4,5,2]]\n", + "```\n", + "\n", + "Una técnica simple pero costosa para conjuntos de datos de entrada más grandes es usar bucles for. En este ejercicio, primero utilizaremos bucles for anidados para iterar a través de cada fila y columna de las matrices, y luego realizaremos la misma multiplicación usando NumPy." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "840e7d0e", + "metadata": {}, + "outputs": [], + "source": [ + "# Usando un bucle for para ingresar dos matrices de tamaño n x m\n", + "matrix1 = [[1,7,3],\n", + " [4,5,2],\n", + " [3,6,1]]\n", + "matrix2 = [[5,4,1],\n", + " [1,2,3],\n", + " [4,5,2]]\n", + " \n", + "res = [[0 for x in range(3)] for y in range(3)]\n", + " \n", + "# Explicit for loops\n", + "for i in range(len(matrix1)):\n", + " for j in range(len(matrix2[0])):\n", + " for k in range(len(matrix2)):\n", + " \n", + " # Matriz resultante\n", + " res[i][j] += matrix1[i][k] * matrix2[k][j]\n", + " \n", + "print(res)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "db6c3355", + "metadata": {}, + "outputs": [], + "source": [ + "# Importar bibliotecas\n", + "\n", + " \n", + "# Ingresar dos matrices\n", + "\n", + " \n", + "# Esto devolverá el producto punto\n", + "\n", + " \n", + "# Imprimir la matriz resultante\n" + ] + }, + { + "cell_type": "markdown", + "id": "785f6c30", + "metadata": {}, + "source": [ + "Fuente: \n", + "\n", + "https://www.youtube.com/channel/UCXq-PLvYAX-EufF5RAPihVg\n", + "\n", + "https://www.geeksforgeeks.org/\n", + "\n", + "https://medium.com/@seehleung/basic-calculus-explained-for-machine-learning-c7f642e7ced3\n", + "\n", + "https://blog.demir.io/understanding-gradient-descent-266fc3dcf02f" + ] + } + ], + "metadata": { + "interpreter": { + "hash": "d3463682613d55fcbb64853e38cc3520a7f67bdf8d6940e781ddcdc423122719" + }, + "kernelspec": { + "display_name": "Python 3.9.12 ('calculus-project')", + "language": "python", + "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.9.12" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}