Saltar al contenido

Aprendizaje automático y redes neuronales: formulario y flashcards

Todas las fórmulas de Aprendizaje automático y redes neuronales en una página, tema por tema, de las lecciones del curso: imprímelas o repásalas con las flashcards.

Programa y lecciones Apuntes (PDF) Apuntes para anotar (PDF) Ejercicios de examen 15 fórmulas

Regresión y descenso por gradiente

El problema del aprendizaje supervisado

    \[ J(\mathbf w) = \frac{1}{n}\sum_{i=1}^n\ell\big(f_{\mathbf w}(\mathbf x_i),\ y_i\big) \]

Regresión lineal y ecuaciones normales

    \[ J(\mathbf w) = \frac{1}{n}\|X\mathbf w - \mathbf y\|^2 \]

Descenso de gradiente

    \[ \mathbf w_{k+1} = \mathbf w_k - \eta\,\nabla J(\mathbf w_k) \]

Perceptrón y redes multicapa

El perceptrón

    \[ \text{if } y_i(\mathbf w^T\mathbf x_i) \le 0:\quad \mathbf w \leftarrow \mathbf w + y_i\mathbf x_i \]

Redes multicapa

    \[ \mathbf h_1 = \phi(W_1\mathbf x + \mathbf b_1),\quad \mathbf h_2 = \phi(W_2\mathbf h_1 + \mathbf b_2),\quad \dots,\quad \hat{\mathbf y} = W_L\mathbf h_{L-1} + \mathbf b_L \]

Optimizadores

Descenso de gradiente estocástico

    \[ \mathbf g_k = \frac{1}{|B|}\sum_{i\in B}\nabla\ell_i(\mathbf w_k),\qquad \mathbf w_{k+1} = \mathbf w_k - \eta\,\mathbf g_k \]

Momento

    \[ \mathbf v_{k+1} = \beta\,\mathbf v_k + \mathbf g_k,\qquad \mathbf w_{k+1} = \mathbf w_k - \eta\,\mathbf v_{k+1} \]

RMSProp y Adam: un tamaño de paso para cada parámetro

    \[ \mathbf m_k = \beta_1\mathbf m_{k-1} + (1 - \beta_1)\mathbf g_k,\qquad \mathbf s_k = \beta_2\mathbf s_{k-1} + (1 - \beta_2)\mathbf g_k^2 \]

    \[ \hat{\mathbf m}_k = \frac{\mathbf m_k}{1 - \beta_1^k},\qquad \hat{\mathbf s}_k = \frac{\mathbf s_k}{1 - \beta_2^k},\qquad \mathbf w_{k+1} = \mathbf w_k - \eta\,\frac{\hat{\mathbf m}_k}{\sqrt{\hat{\mathbf s}_k} + \epsilon} \]

Redes convolucionales

La convolución

    \[ (I * K)(i, j) = \sum_{m}\sum_{n}I(i + m,\ j + n)\,K(m, n) \]

Los tamaños

    \[ n_{out} = \Big\lfloor\frac{n + 2p - k}{s}\Big\rfloor + 1 \]

Redes recurrentes y transformers

Redes recurrentes

    \[ \mathbf h_t = \tanh(W\mathbf h_{t-1} + U\mathbf x_t + \mathbf b) \]

La LSTM

    \[ \mathbf f_t,\ \mathbf i_t,\ \mathbf o_t = \sigma(\dots),\qquad \mathbf c_t = \mathbf f_t\odot\mathbf c_{t-1} + \mathbf i_t\odot\tanh(\dots),\qquad \mathbf h_t = \mathbf o_t\odot\tanh(\mathbf c_t) \]

Atención

    \[ \text{Attention}(Q, K, V) = \text{softmax}\Big(\frac{QK^T}{\sqrt{d_k}}\Big)V \]

Entrenamiento en la práctica

Métricas

    \[ \text{precision} = \frac{TP}{TP + FP},\qquad \text{recall} = \frac{TP}{TP + FN},\qquad F_1 = \frac{2\cdot\text{precision}\cdot\text{recall}}{\text{precision} + \text{recall}} \]