triplet loss.tex (2703B)
1 \tikzset{ 2 nsnode/.style={inner sep=0.5mm}, 3 nshighlight/.style={draw=#1, fill=#1!30!white, inner sep=0}, 4 } 5 \begin{frame}{Aligning Linguistic and Topological Similarities} 6 Use the topological features to identify the relational information in the linguistic features. 7 8 \bigskip 9 10 \begin{tikzpicture}[remember picture, overlay, on background layer] 11 \only<2->{ 12 \coordinate (triplet-right) at ($(triplet-negative1.east) + (7mm, 0)$); 13 \coordinate (triplet-positive-i) at ($(pic cs:triplet-1) + (1mm, 0.3em)$); 14 \node[nshighlight=Dark2-A, fit=(triplet-positive)] (triplet-positive-n) {}; 15 \draw[arrow, Dark2-A, rounded corners=1mm] (triplet-positive-n.east) -- (triplet-positive-n.east -| triplet-right) -- (triplet-positive-i -| triplet-right) -- (triplet-positive-i); 16 } 17 18 \only<3->{ 19 \coordinate (triplet-right-2) at ($(triplet-right) + (1mm, 0)$); 20 \coordinate (triplet-negative-i) at ($(pic cs:triplet-2) + (1mm, 0.3em)$); 21 \node[nshighlight=Dark2-B, fit=(triplet-negative1) (triplet-negative2)] (triplet-negative-n) {}; 22 \draw[arrow, Dark2-B, rounded corners=1mm] (triplet-negative-n.east) -- (triplet-negative-n.east -| triplet-right-2) -- (triplet-negative-i -| triplet-right-2) -- (triplet-negative-i); 23 } 24 25 \only<4>{ 26 \coordinate (triplet-right-3) at ($(triplet-right) + (2mm, 0)$); 27 \coordinate (triplet-margin-i) at ($(pic cs:triplet-3) + (1mm, 0.3em)$); 28 \node[nshighlight=Dark2-C, fit=(triplet-margin)] (triplet-margin-n) {}; 29 \coordinate (triplet-margin-top) at ($(triplet-margin-n.north) + (0, 3mm)$); 30 \draw[arrow, Dark2-C, rounded corners=1mm] (triplet-margin-n.north) -- (triplet-margin-top) -- (triplet-margin-top -| triplet-right-3) -- (triplet-margin-i -| triplet-right-3) -- (triplet-margin-i); 31 } 32 \end{tikzpicture} 33 \begin{equation*} 34 \loss{lt}(x_1, x_2, x_3) = \max\left( 35 \begin{aligned} 36 0, \tikzmarknode[nsnode]{triplet-margin}{\zeta} & 37 + 2 \tikzmarknode[nsnode]{triplet-positive}{\big(\operatorname{sim}_\text{ling}(x_1, x_2) - \operatorname{sim}_\text{topo}(x_1, x_2)\big)^2} \\ 38 & \hspace{1cm} - \tikzmarknode[nsnode]{triplet-negative1}{\big(\operatorname{sim}_\text{ling}(x_1, x_2) - \operatorname{sim}_\text{topo}(x_1, x_3)\big)^2} \\ 39 & \hspace{1cm} - \tikzmarknode[nsnode]{triplet-negative2}{\big(\operatorname{sim}_\text{ling}(x_1, x_3) - \operatorname{sim}_\text{topo}(x_1, x_2)\big)^2} 40 \end{aligned} 41 \right) 42 \end{equation*} 43 44 \pause 45 \bigskip 46 47 \begin{itemize}[<+->] 48 \item Idealy we want to align the two similarities.\tikzmark{triplet-1} 49 \item However to stabilize the loss we need to use negative samples.\tikzmark{triplet-2} 50 \item Up to a margin \(\zeta\).\tikzmark{triplet-3} 51 \end{itemize} 52 \end{frame}