\documentclass{beamer}
\usetheme[progressbar=frametitle]{metropolis}

% g \in G is explanation as a model
% f is the model we're trying to explain
% does, being model agnostic, means we do not care about specifics of f.
% We use Locally Weighted Square Loss as L, where I suspect pi is the weight and we thus estimate the difference between the actual model
% and our explanation, and multiply this with the proximity of the data point z, to x.
% Spørg lige Lasse hvorfor min(L(f,g,pi_x(z)) + omega(g)) bliver intractable, når omega(g) er en konstant!




\usepackage{setspace}
\usepackage[T1]{fontenc}
\usepackage[sfdefault,scaled=.85]{FiraSans}
%\usepackage{newtxsf}
\usepackage[ruled, linesnumbered]{algorithm2e}
\SetKwInput{kwRequire}{Require}
\SetKw{kwExpl}{explain}

\title{Why Should I Trust You?}
\subtitle{Explaining the Predictions of Any Classifier}
\author{Casper Vestergaard Kristensen \and Alexander Munch-Hansen}
\institute{Aarhus University}
\date{\today}

\begin{document}
\begin{frame}
\titlepage
\end{frame}

\begin{frame}
  \setbeamertemplate{section in toc}[sections numbered]
  \frametitle{Outline}
  \setstretch{0.5}
  \tableofcontents

\end{frame}





\section{Meta information}
%\subsection{Authors}
 
\begin{frame}
\frametitle{Authors}
\begin{itemize}
\item Marco Tulio Ribeiro
\item Sameer Singh
\item Carlos Guestrin
\end{itemize}
\end{frame}

%\subsection{Publishing}

\begin{frame}[fragile]{Metropolis}
  \frametitle{Publishing}
  
  \begin{itemize}
  \item Conference Paper, Research
  \item KDD '16 Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining
    \begin{itemize}
    \item A premier interdisciplinary conference, brings together researchers and practitioners from data science, data mining, knowledge discovery, large-scale data analytics, and big data.
    \item Sigkdd has the highest h5 index of any conference involving databases or data in general
    \item Highly trusted source
    \end{itemize}
  \end{itemize}
\end{frame}

  \section{Article}

  %\subsection{Problem}

  \begin{frame}
    \frametitle{Problem definition}
    \begin{itemize}
    \item People often use Machine Learning models for predictions
    \item Blindly trusting a prediction can lead to poor decision making
    \item We seek to understand the reasons behind predictions
      \begin{itemize}
      \item As well as the model doing the predictions
      \end{itemize}
    \end{itemize}
  \end{frame}

  %\subsection{Previous Solutions}
  \begin{frame}
    \frametitle{Previous Solutions}
    \begin{itemize}
    \item Relying on accuracy based on validation set
    \end{itemize}
  \end{frame}


  \begin{frame}
    \frametitle{A look into two predictions}
    \includegraphics[scale=0.25]{graphics/christ_vs_atheism.png}
  \end{frame}

  \begin{frame}
    \frametitle{A look into two predictions}
    \includegraphics[scale=0.25]{graphics/christ_vs_atheism_annotated_1.png}
  \end{frame}
  
  \begin{frame}
    \frametitle{A look into two predictions}
    \includegraphics[scale=0.25]{graphics/christ_vs_atheism_annotated_2.png}
  \end{frame}

  \subsection{The LIME framework}
  \begin{frame}
    \frametitle{LIME}
    \begin{itemize}
    \item The algorithm created
    \item Explains the predictions of \emph{any} classifier or regressor in a faithful way, by approximating it locally with an \emph{interpretable} model.
    \end{itemize}
  \end{frame}

  \begin{frame}
    \frametitle{Intepretability}
  \end{frame}
  
  \begin{frame}
    \frametitle{Fidelity}
  \end{frame}


  \subsection{Explaining Predictions}
 % \subsubsection{Examples}
  \begin{frame}
    % \frametitle{Sparse Linear Explanations}
    \frametitle{Explaining an individual prediction}
    \begin{algorithm}[H]
      \setstretch{0.9}
\SetAlgoLined
\kwRequire{Classifier $f$, Number of samples $N$}
\kwRequire{Instance $x$, and its intepretable version $x^{\prime}$}
\kwRequire{Similarity kernel $\pi_x$, Length of explanation $K$}
\Indp
 $\mathcal{Z} \leftarrow \{\}$ \\
 \For{$i \in \{1,2,3,\dots, N\}$}{
   $z_i^{\prime} \leftarrow sample\_around(x^{\prime})$ \\
   $\mathcal{Z} \leftarrow \mathcal{Z} \cup  \langle z_i^{\prime}, f(z_i), \pi_{x}(z_i) \rangle$ \\
 }
 $w \leftarrow \text{K-Lasso}(\mathcal{Z},K) \vartriangleright \text{with } z_i^{\prime} \text{ as features, } f(z) \text{ as target}$ \\
\Return $w$
 \caption{Sparse Linear Explanations using LIME}
\end{algorithm}
% This algorithm approximates the minimization problem of computing a single individual explanation of a prediction.
% K-Lasso is the procedure of learning the weights via least squares. Wtf are these weights???
  \end{frame}


  \begin{frame}
    \frametitle{Text Classification}
  \end{frame}

  \begin{frame}
    \frametitle{Deep Networks for Images}
  \end{frame}
  \subsection{Explaining Models}
  
  \begin{frame}
    \frametitle{Submodular Picks}
        \begin{algorithm}[H]
      \setstretch{0.9}
\SetAlgoLined
\kwRequire{Instances $X$, Budget $B$}
\Indp
 \ForAll{$x_i \in X$}{
   $W_i \leftarrow \mathbf{explain}(x_i, x_i^{\prime})$ \qquad \qquad $\vartriangleright$ Using Algorithm 1
 }
 \For{$j \in \{1\dots d^{\prime}$} {
   $I_j \leftarrow \sqrt{\sum_{i=1}^n |W_{ij}|}$ \qquad \qquad \quad $\vartriangleright$ Compute feature importances
 }
 $V \leftarrow \{\}$ \\
 \While(\qquad \qquad \qquad \quad \ \ $\vartriangleright$ Greedy optimisation of Eq 4){$|V| < B$} {
   $V \leftarrow V \cup  \text{argmax}_i \ c(V \cup \{i\}, W, i)$
   }
\Return $V$
 \caption{Submodular pick (SP) algorithm}
\end{algorithm}
  \end{frame}

  \section{Experiments}
  %\subsection{Simulated User Experiments}
  %\subsubsection{Setup}
  \begin{frame}
    \frametitle{Setup}
  \end{frame}
  %\subsection{Human Subjects}

  \section{Conclusion}
  
  \begin{frame}
    \frametitle{Conclusion}
  \end{frame}

  \section{Recap}
  \begin{frame}
    \frametitle{Recap}
  \end{frame}
\end{document}
