\documentclass[aspectratio=169,10pt]{beamer}
\usetheme[progressbar=head,numbering=fraction,sectionpage=none]{metropolis}

\usepackage{graphicx}
\usepackage{ulem}
\usepackage{xcolor}
\usepackage[scale=2]{ccicons}
\usepackage{pgfplots}
\usepackage{booktabs}
\usepgfplotslibrary{dateplot}
\usepackage{hyperref}
\usepackage{multirow}
\usepackage{array}
\usepackage{xspace}

\title{Device State Detector (DSD): Technical Presentation}
\subtitle{Trust me I've read a book.}
\date{}
\author{Arthur Grisel-Davy}
\institute{University of Waterloo, Canada}


\begin{document}

\maketitle

\begin{frame}{Context}
\begin{center}
\textit{For any power trace $t$ captured on from a machine $M$, detect the state $C_i$ of the machine for every sample $t[n]$.}\\
\vspace{1cm}
\textit{Assign a class $C_i$, to every sample of a power trace $t[n]$ from a machine $M$ corresponding to a state of the machine, from a set of pre-established states.}
\end{center}
\vfill
$\Longrightarrow$ Supervised, multi-class, mono-label, classification problem.
\end{frame}

\begin{frame}{Definitions}
\begin{itemize}
\item $t$: a power trace of fixed sampling rate and length $N$. $t[n] \forall n\in[1,N]$ are the samples value of $t$.
\item $p_i$: The proto examples of the states. Power traces corresponding to the $P$ states to detect. Each proto is of length $N_i$, not necessarily equals.
\end{itemize}
\end{frame}

\begin{frame}{Normalized distance}
\begin{align}
    &nd: a\times b \in T^2 \rightarrow \mathbb{R} \nonumber\\
    &nd(a,b) = \dfrac{Eucd(a,b)}{N_b}
\end{align}
\end{frame}

\begin{frame}{1-Nearest Neighbor - Center}
\begin{itemize}
\item Place sample at center of window.
\item Compute normalized distances to each proto.
\item Assign to closest proto.
\end{itemize}
\end{frame}

\begin{frame}{1-Nearest Neighbor}
\includegraphics[width=\textwidth]{images/detection_real___empty_1NNcenter.pdf}
\end{frame}

\begin{frame}{Performance metric}
\begin{itemize}
    \item Accuracy: $Acc = \dfrac{1}{N}\sum_{n\in N}1_{(l[n] = true[n])}$
    \item Levenshtein Distance: number of miss/non detected states.
\end{itemize}
\end{frame}

\begin{frame}{1-Nearest Neighbor - Dynamic position}
\begin{figure}
\centering
\includegraphics[width=0.9\textwidth]{images/presentation_Page 1_presentation.pdf}
\end{figure}
\end{frame}

\begin{frame}{1-Nearest Neighbor - Dynamic position}
\includegraphics[width=\textwidth]{images/detection_real___empty_1NNmin.pdf}
\end{frame}

\begin{frame}{1-Nearest Neighbor - Dynamic position}
\includegraphics[width=\textwidth]{images/detection_real_asus_1_1NNmin.png}
\end{frame}

\begin{frame}{1-Nearest Neighbor - Dynamic position}
\includegraphics[width=\textwidth]{images/detection_real_DELL-1_1NNmin.png}
\end{frame}

\begin{frame}{1-Nearest Neighbor - Dynamic Distance}
\begin{align}\label{eq:distance_original}
    &dynd: t[n]\times p_i \in (t, protos)\nonumber\\
    &dynd(a,b) = \min_{k\in [n-N_i,n+N_i])}(nd(t[n-k:n-k+N_i],p_i))
\end{align}
\end{frame}

\begin{frame}{Limitations of the method}
\begin{itemize}
    \item Significant miss-classification between close classes.
    \item Impossibility to detect outlier/out-of-scope patterns.
    \item Rely too much on protos \textit{tiling} assumption.
\end{itemize}
\end{frame}

\begin{frame}{1-Nearest Neighbor - Shrinkage}
\includegraphics[width=\textwidth]{images/NN_schematic_presentation_DSD_Page 1.pdf}
\end{frame}

\begin{frame}{1-Nearest Neighbor - Shrinkage}
\includegraphics[width=\textwidth]{images/NN_schematic_presentation_DSD_Page 2.pdf}
\end{frame}

\begin{frame}{1-Nearest Neighbor - Shrinkage}
\includegraphics[width=\textwidth]{images/NN_schematic_presentation_DSD_Page 3.pdf}
\end{frame}

\begin{frame}{1-Nearest Neighbor - Shrinkage}
\includegraphics[width=\textwidth]{images/NN_schematic_presentation_DSD_Page 4.pdf}
\end{frame}

\begin{frame}{1-Nearest Neighbor - Shrinkage}
\includegraphics[width=\textwidth]{images/NN_schematic_presentation_DSD_Page 5.pdf}
\end{frame}

\begin{frame}{1-Nearest Neighbor - Shrinkage}
\includegraphics[width=\textwidth]{images/NN_schematic_presentation_DSD_Page 6.pdf}
\end{frame}

\begin{frame}{Variable Length Normalized Distance}
\begin{align}\label{eq:distance_original}
    &vlnd: t[n]\times p_i \in (t, protos)\nonumber\\
    &vlnd(a,b) = \min_{k\in [n-N_i,n+N_i])}(nd(t[n-k:n-k+N_i],p_i))
\end{align}
\end{frame}

\begin{frame}{Checkpoint}
Three distance measures:
\begin{itemize}
\item Normalized Distance, to compare distances to protos: 
\begin{equation}nd(a,b) = \dfrac{Eucd(a,b)}{N_b}\end{equation}
\item Dynamic Distance, to compare sample arc to protos: \begin{equation}dynd(a,b) = \min_{k\in [n-N_i,n+N_i])}(nd(t[n-k:n-k+N_i],p_i))\end{equation}
\item Variable Length Normalized Distance, to get protos inter-distances: \begin{equation}vlnd(a,b) = \min_{k\in [n-N_i,n+N_i])}(nd(t[n-k:n-k+N_i],p_i))\end{equation}
\end{itemize}
\end{frame}

\begin{frame}{1-Nearest Neighbor - Shrinkage}
\includegraphics[width=\textwidth]{images/NN_schematic_presentation_DSD_Page 7.pdf}
\end{frame}

\begin{frame}{1-Nearest Neighbor - Shrinkage}
\includegraphics[width=\textwidth]{images/NN_schematic_presentation_DSD_Page 8.pdf}
\end{frame}

\begin{frame}{1-Nearest Neighbor - Shrinkage $\alpha=1$}
\includegraphics[width=\textwidth]{images/detection_real___empty_1_1NNmin}
\end{frame}
\begin{frame}{1-Nearest Neighbor - Shrinkage $\alpha=0.75$}
\includegraphics[width=\textwidth]{images/detection_real___empty_0.75_1NNmin}
\end{frame}
\begin{frame}{1-Nearest Neighbor - Shrinkage $\alpha=0.5$}
\includegraphics[width=\textwidth]{images/detection_real___empty_0.5_1NNmin}
\end{frame}

\begin{frame}{1-Nearest Neighbor - Shrinkage $\alpha=2$}
\includegraphics[width=\textwidth]{images/detection_real_DELL-1_2_1NNmin.png}
\end{frame}
\begin{frame}{1-Nearest Neighbor - Shrinkage $\alpha=1$}
\includegraphics[width=\textwidth]{images/detection_real_DELL-1_1_1NNmin.png}
\end{frame}

\begin{frame}{Conclusion}
    DSD is:
    \begin{itemize}
        \item an implementation of 1-NN with custom distances and shrinkage.
        \item easily adaptable to multiple protos per class.
        \item extremely low on data requirement.
        \item able to detects $P+1$ classes.
        \item parametrized by only $\alpha$ to controle miss/un -classification tradeoff.
    \end{itemize}
\end{frame}

\begin{frame}{Future Work}
\begin{itemize}
    \item Capture and label more data.
    \item Evaluate possibility of uneven shrinkage.
    \item Enable multiple protos per class i.e. \textit{more-than-one}-NN
\end{itemize}
    
\end{frame}

\end{document}
