PhD

The LaTeX sources of my Ph.D. thesis
git clone https://esimon.eu/repos/PhD.git
Log | Files | Refs | README | LICENSE

negative sampling.tex (3600B)


      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}{Negative Sampling Approximation}
      6 	\begin{tikzpicture}[remember picture, overlay, on background layer]
      7 		\only<2->{
      8 			\coordinate (negsampl-dataset-left) at ($(pic cs:negsampl-1) + (-15mm, 0)$);
      9 			\coordinate (negsampl-dataset-i) at ($(pic cs:negsampl-1) + (-6mm, 0.3em)$);
     10 			\node[nshighlight=Dark2-A, fit=(negsampl-dataset)] (negsampl-dataset-n) {};
     11 			\draw[arrow, Dark2-A, rounded corners=1mm] (negsampl-dataset-n.west) -- (negsampl-dataset-n.west-|negsampl-dataset-left) -- (negsampl-dataset-i-|negsampl-dataset-left) -- (negsampl-dataset-i);
     12 		}
     13 		\only<3->{
     14 			\coordinate (negsampl-classifier-left) at ($(pic cs:negsampl-2) + (-14mm, 0)$);
     15 			\coordinate (negsampl-classifier-i) at ($(pic cs:negsampl-2) + (-6mm, 0.3em)$);
     16 			\node[nshighlight=Dark2-B, fit=(negsampl-classifier)] (negsampl-classifier-n) {};
     17 			\draw[arrow, Dark2-B, rounded corners=1mm] (negsampl-classifier-n.west) -- (negsampl-classifier-n.west-|negsampl-classifier-left) -- (negsampl-classifier-i-|negsampl-classifier-left) -- (negsampl-classifier-i);
     18 		}
     19 		\only<4->{
     20 			\coordinate (negsampl-positive-right) at ($(negsampl-negative2.east) + (11mm, 0)$);
     21 			\coordinate (negsampl-positive-i) at ($(pic cs:negsampl-3) + (1mm, 0.3em)$);
     22 			\node[nshighlight=Dark2-C, fit=(negsampl-positive)] (negsampl-positive-n) {};
     23 			\draw[arrow, Dark2-C, rounded corners=1mm] (negsampl-positive-n.east) -- (negsampl-positive-n.east-|negsampl-positive-right) -- (negsampl-positive-i-|negsampl-positive-right) -- (negsampl-positive-i);
     24 		}
     25 		\only<5->{
     26 			\coordinate (negsampl-negative-right) at ($(negsampl-negative2.east) + (10mm, 0)$);
     27 			\coordinate (negsampl-negative-i) at ($(pic cs:negsampl-4) + (1mm, 0.3em)$);
     28 			\node[nshighlight=Dark2-D, fit=(negsampl-negative1) (negsampl-negative2)] (negsampl-negative-n) {};
     29 			\draw[arrow, Dark2-D, rounded corners=1mm] (negsampl-negative-n.east) -- (negsampl-negative-n.east-|negsampl-negative-right) -- (negsampl-negative-i-|negsampl-negative-right) -- (negsampl-negative-i);
     30 		}
     31 	\end{tikzpicture}
     32 	\begin{equation*}
     33 		\begin{split}
     34 			\loss{ep}(\vctr{\theta}, \vctr{\phi}) =
     35 			\expectation_{\raisebox{-3mm}[0mm][0mm]{\(\substack{\tikzmarknode[nsnode]{negsampl-dataset}{(\rndm{s}, \rndm{e}_1, \rndm{e}_2)\sim \uniformDistribution(\dataSet)}\\\tikzmarknode[nsnode]{negsampl-classifier}{\rndm{r}\sim \operatorname{\text{PCNN}}(\rndm{s}; \vctr{\phi})}}\)}}
     36 			\bigg[ & \tikzmarknode{negsampl-positive}{- \log \sigmoid \left( \psi(\rndm{e}_1, \rndm{r}, \rndm{e}_2; \vctr{\theta})\right)} \\
     37 			& \tikzmarknode{negsampl-negative1}{- \sum_{j=1}^k \expectation_{\rndm{e}'\sim\uniformDistribution_\dataSet(\entitySet)} \left[ \log \sigmoid \left( - \psi(\rndm{e}_1, \rndm{r}, \rndm{e}'; \vctr{\theta})\right) \right]} \\
     38 			& \tikzmarknode{negsampl-negative2}{- \sum_{j=1}^k \expectation_{\rndm{e}'\sim\uniformDistribution_\dataSet(\entitySet)} \left[ \log \sigmoid \left( - \psi(\rndm{e}', \rndm{r}, \rndm{e}_2; \vctr{\theta})\right) \right]} \bigg]
     39 		\end{split}
     40 	\end{equation*}
     41 
     42 	\bigskip
     43 
     44 	\pause
     45 
     46 	\begin{center}
     47 		\begin{minipage}{11cm}
     48 			\begin{enumerate}[<+->]
     49 				\item \tikzmark{negsampl-1}Take a sample uniformly from the dataset.
     50 				\item \tikzmark{negsampl-2}Sample a relation \(\rndm{r}\) from the output of the PCNN classifier.
     51 				\item Increase the energy of this fact.\tikzmark{negsampl-3}
     52 				\item Decrease the energy of negative facts. (\hypothesis{\(1\to1\)})\tikzmark{negsampl-4}
     53 			\end{enumerate}
     54 		\end{minipage}
     55 	\end{center}
     56 \end{frame}