Skip to content

Commit

Permalink
Mejorar diagramas
Browse files Browse the repository at this point in the history
  • Loading branch information
felipegonzalez committed Sep 26, 2023
1 parent eb655fb commit f8b768b
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 1 deletion.
6 changes: 5 additions & 1 deletion notas/11-val-cruzada.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ con varios parámetros afinados (como la $\lambda$ de regresión ridge).




Cuando tenemos datos abundantes, este enfoque es el usual. Por ejemplo,
podemos dividir la muestra en 50-25-25 por ciento. Ajustamos modelos
con el primer 50\%, evaluamos y seleccionamos con el segundo 25\% y finalmente,
Expand Down Expand Up @@ -89,6 +90,9 @@ es el de **validación cruzada**, que es un método computacional
para producir una estimación interna (usando sólo muestra de entrenamiento)
del error de predicción.

![](./figuras/div_muestra_cv_1.png)


Validación cruzada también tiene nos da diagnósticos adicionales para entender
la variación del desempeño según el conjunto de datos de entrenamiento que usemos,
algo que es más difícil ver si solo tenemos una muestra de validación.
Expand All @@ -100,7 +104,7 @@ ${\mathcal L}=\{ (x_i,y_i)\}_{i=1}^n$:

$$ {\mathcal L}={\mathcal L}_1\cup {\mathcal L}_2\cup\cdots\cup {\mathcal L}_k.$$

![](./figuras/div_muestra_cv.png)
![](./figuras/div_muestra_cv.png){width=300}

Construimos $k$ modelos distintos, digamos $\hat{f}_j$, usando solamente
la muestra ${\mathcal L}-{\mathcal L}_j$, para $j=1,2,\ldots, k$. Cada uno de estos modelos lo evaluamos
Expand Down
Binary file modified notas/figuras/div_muestra.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions notas/figuras/div_muestra_1.gv
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
digraph{

graph[rankdir = TB]

node[shape = plaintext style = filled ]


node[fillcolor = White, margin = 0.2]
C[label = Datos]

node[fillcolor = Cyan, margin = 0.2]
D[label = <Entrenamiento <FONT POINT-SIZE="11.0"><BR/>Ajuste de parámetros <BR/> de modelos</FONT>>]
node[fillcolor = Yellow, margin = 0.2]
E[label = <Validación <FONT POINT-SIZE="11.0"><BR/>Afinación de hiperparámetros <BR/> y selección de candidatos</FONT>>]
node[fillcolor = Salmon, margin = 0.2]
F[label = <Prueba <FONT POINT-SIZE="11.0"><BR/>Evaluación final</FONT>>]

edge[color = black, arrowhead = vee, arrowsize = 1.0]
C -> D
C -> E
C -> F
}
31 changes: 31 additions & 0 deletions notas/figuras/div_muestra_2.gv
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
digraph{

graph[rankdir = TB]

node[shape = plaintext style = filled ]


node[fillcolor = White, margin = 0.2]
C[label = Datos]

node[fillcolor = Cyan, margin = 0.2]
D[label = <Entrenamiento <FONT POINT-SIZE="11.0"><BR/>Ajuste de parámetros de modelos</FONT>>]
node[fillcolor = Salmon, margin = 0.2]
Q[label = <Prueba <FONT POINT-SIZE="11.0"><BR/>Evaluación final</FONT>>]

node[fillcolor = Yellow, margin = 0.2]
E[label = <Entrena 1 <BR/> Validación 1>]
F[label = <Entrena 2 <BR/> Validación 2>]
G[label = <Entrena 3 <BR/> Validación 3>]
H[label = <Entrena 4 <BR/> Validación 4>]
I[label = <Entrena 5 <BR/> Validación 5>]
edge[color = black, arrowhead = vee, arrowsize = 1.0]
C -> D
C -> Q
D -> E
D -> F
D -> G
D -> H
D -> I
{rank = max; Q}
}
Binary file added notas/figuras/div_muestra_cv_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f8b768b

Please sign in to comment.