Ir al contenido

Resumen 1 · Regresión lineal

⬇ Descargar PDF · ir a la teoría completa · imprime con Ctrl + P

  • Modelo y^=Xw\hat{\mathbf{y}} = \mathbf{X}\mathbf{w}; la columna de unos absorbe el sesgo. Residual ri=yi−y^ir_i = y_i - \hat y_i.
  • Costo J=∥y−Xw∥2J = \Vert\mathbf{y}-\mathbf{X}\mathbf{w}\Vert^2: convexo porque v⊤X⊤Xv=∥Xv∥2≥0\mathbf{v}^\top\mathbf{X}^\top\mathbf{X}\mathbf{v} = \Vert\mathbf{X}\mathbf{v}\Vert^2\ge0.
  • Dos rutas, misma respuesta: gradiente = 0 o proyección ortogonal de y\mathbf{y} sobre el espacio columna (X⊤r=0\mathbf{X}^\top\mathbf{r}=0).
  • Cuadrados = máxima verosimilitud con ruido gaussiano (Laplace daría error absoluto).
  • Descenso de gradiente cuando dd o nn son grandes o no hay forma cerrada. Estandarizar redondea el bowl. Batch / SGD / mini-batch.
  • Polinomios: lineal en los pesos, curvo en xx. Overfitting ⇒ pesos que explotan.
X⊤Xw=X⊤y  ⇒  w⋆=(X⊤X)−1X⊤y\mathbf{X}^\top\mathbf{X}\mathbf{w} = \mathbf{X}^\top\mathbf{y}\;\Rightarrow\; \mathbf{w}^\star = (\mathbf{X}^\top\mathbf{X})^{-1}\mathbf{X}^\top\mathbf{y} ∇J=2X⊤(Xw−y)=−2X⊤r\nabla J = 2\mathbf{X}^\top(\mathbf{X}\mathbf{w}-\mathbf{y}) = -2\mathbf{X}^\top\mathbf{r} H=X(X⊤X)−1X⊤,y^=Hy,H2=H\mathbf{H} = \mathbf{X}(\mathbf{X}^\top\mathbf{X})^{-1}\mathbf{X}^\top,\quad \hat{\mathbf{y}} = \mathbf{H}\mathbf{y},\quad \mathbf{H}^2 = \mathbf{H} w1=∑(xi−xˉ)(yi−yˉ)∑(xi−xˉ)2,w0=yˉ−w1xˉw_1 = \frac{\sum(x_i-\bar x)(y_i-\bar y)}{\sum(x_i-\bar x)^2},\qquad w_0 = \bar y - w_1\bar x RMSE=1n∑ri2,MAE=1n∑∣ri∣,R2=1−SSresSStot\text{RMSE}=\sqrt{\tfrac1n\textstyle\sum r_i^2},\quad \text{MAE}=\tfrac1n\textstyle\sum\lvert r_i\rvert,\quad R^2 = 1 - \frac{SS_\text{res}}{SS_\text{tot}}
  • JJ es convexa.
  • Con η=0\eta=0 no se aprende nada; el signo menos importa.
  • R2R^2 puede ser negativo en validación.
  • RMSE ≥ MAE; la brecha delata outliers.
  • Un peso es asociación, no causalidad; compara magnitudes solo con features estandarizadas.