\section{Lebesgue Measure}
\subsection{Introduction}
  \paragraph{1.}
  \begin{proof}
    Since $\mathfrak{M}$ is an $\sigma$-algebra, $B\setminus A \in\mathfrak{M}$
    as long as $A,B\in\mathfrak{M}$. Since $B\setminus A$ and $A$ are disjoint,
    $mB=mA+m(B\setminus A)\ge mA$ since $m$ is nonnegative.
  \end{proof}

  \paragraph{2.}
  \begin{proof}
    Let $A_0 = E_0$ and $E_k=A_k\setminus A_{k-1}$ for $k\ge 1$. Clear that
    $E_i$ and $E_j$ are disjoint for distinct $i$ and $j$, $\bigcup A_n=\bigcup
    E_n$ and $A_i\subset E_i$ for every $i$. Hence,
    \[
      m\left(\bigcup E_n\right) = m\left(\bigcup A_n\right)
      = \sum mA_n \le \sum mE_n,
    \]
    where the last inequality comes from Exercise 1.
  \end{proof}

  \paragraph{3.}
  \begin{proof}
    Suppose that $mA<\infty$. Then $mA=m(A\cup\varnothing)=mA+m\varnothing$,
    implying that $m\varnothing=0$.
  \end{proof}
% end

\subsection{Outer Measure}
  \paragraph{5.}
  \begin{proof}
    We show that $\{I_n\}$ must cover the entire $[0,1]$ by contradiction.
    Assume that $x\notin I_k$ for $k=1,2,\dots,n$. Then, as $I_k$ are open and
    $n$ is finite, there exists some $\vep>0$ such that $(x-\vep,x+\vep)$ and
    $I_k$ are disjoint for every $k$. Since $\mathbb{Q}$ is dense in
    $\mathbb{R}$, there exists some rational number in $(x-\vep, x+\vep)$,
    contradicting with the hypothesis that $\{I_k\}$ covers all rational numbers
    between $0$ and $1$.
  \end{proof}

  \paragraph{6.}
  \begin{proof}
    By the definition of the outer measure, for every $\vep > 0$, there exists
    some collection $\{I_n\}$ of open intervals that covers $A$ and $\sum l(I_n)
    \le m^*A+\vep$. Let $O=\bigcup I_n$. $O$ is a countable union of open sets
    and therefore is also open. And by Proposition 2, $m^*O\le \sum l(I_n)$.
    Thus, $m^*O\le m^*A+\vep$. \par
    Let $\vep_n = 1/n$ and for each $n$, by the previous discussion, we can
    always get an open set $O_k$ such that $A\subset O_k$ and $m^*O\le m^*A+
    \vep_m$. Let $G$ be the countable intersection of these open sets. Clear
    that $G$ is a $G_\delta$ set covering $A$ and $m^*A=m^*G$.
  \end{proof}

  \paragraph{7.}
  \begin{proof}
    If $m^*E=\infty$, it is trivial. Suppose that $m^*E\le\infty$. For any $x\in
    \mathbb{R}$, collection $\{I_n\}$ of open intervals covers $E+x$ iff $\{I_n
    -x\}$ covers $E$. Since the length of intervals is translation invariant,
    this implies $m^*(E+x)=m^*E$.
  \end{proof}

  \paragraph{8.}
  \begin{proof}
    Clear that $m^*A\le m^*(A\cup B)$. Meanwhile, $m^*(A\cup B) = m^*A + m^*B =
    m^*B$. Hence, $m^*(A\cup B)=m^*B$.
  \end{proof}
% end

\subsection{Measurable Sets and Lebesgue Measure}
  \paragraph{10.}
  \begin{proof}
    \begin{align*}
      mE_1+mE_2
      &= mE_1 + m(E_2\setminus E_1) + m(E_1\cap E_2) \\
      &= m(E_1\cup(E_2\setminus E_1)) + m(E_1\cap E_2) \\
      &= m(E_1\cup E_2) + m(E_1\cap E_2).
    \end{align*}
  \end{proof}

  \paragraph{11.}
  \begin{proof}
    $E_n = (n,\infty)$.
  \end{proof}

  \paragraph{12.}
    This is the countable version of Lemma 9.
  \begin{proof}
    It suffices to prove $m^*(A\cap \bigcup E_i) \ge \sum m^*(A\cap E_i)$. Since
    $\bigcup_{i=1}^\infty E_i\supset \bigcup_{i=1}^n E_i$ for every $n$,
    \begin{align*}
      m^*\left(A\cap \bigcup_{i=1}^\infty E_i\right)
      \ge m^*\left(A\cap \bigcup_{i=1}^n E_i\right)
      = \sum_{i=1}^n m^*(A\cap E_i),
    \end{align*}
    where the equality comes from Lemma 9. Since the left hand side is
    independent of $n$, we have
    \[
      m^*\left(A\cap \bigcup_{i=1}^\infty E_i\right) \ge
      \sum_{i=1}^\infty m^*(A\cap E_i),
    \]
    completing the proof.
  \end{proof}

  \paragraph{13.}
  \begin{proof}
    First we suppose that $m^*E<\infty$. By Proposition 5, there exists some
    open set $O\supset E$ such that $m^*O\le m^*E+\vep$. If $E$ is measurable,
    then by the definition,
    \[
      m^*(O\setminus E) = m^*O-m^*E \le \vep.
    \]
    Namely, (ii) holds. Meanwhile, $O\subset\mathbb{R}$ is a countable union of
    disjoint open intervals $\{I_n\}$. Since $mO=m^*O$ is bounded and $mO=\sum
    l(I_n)$, there exists some integer $N>0$ such that $mO-\sum_{n=1}^N l(I_n)<
    \vep$. Let $U=\bigcup_{n=1}^N I_n$.
    \begin{align*}
      m^*(U\bigtriangleup E)
      &= m^*((U\cup E) \setminus (U\cap E)) \\
      & \le m^*(O\setminus (U\cap E))  \\
      & = m^*((O\setminus U) \cup (O\setminus E)) \\
      &\le m^*(O\setminus U) + m^*(O\setminus E)  \\
      &\le 2\vep.
    \end{align*}
    Hence, (ii) implies (vi). Now we show that (vi) implies (ii). If $m^*(U
    \bigtriangleup E)<\vep $, then there exists some countable collection $\{J_n
    \}$ of open interval such that
    \[
      \sum l(J_n)\le m^*(U\bigtriangleup E)+\vep<2\vep.
    \]
    Let $J=\bigcup J_n$ and $O= U\cup J$. $m^*J < 2\vep$. And $O$ is open and
    covers $E$. Meanwhile,
    \[
      m^*(O\setminus E) \le m^*(U\setminus E)+m^*(J\setminus E) < 3\vep.
    \]
    Hence, (ii) holds.\par
    Now, let $E$ be an arbitrary set and $E_n=E\cap(-n, n)$, which is a set with
    finite measure. Then by the previous discussion, there exists some open set
    $O_n\supset E_n$ with $m^*(O_n\setminus E_n)<\vep/2^n$. Let $O=\bigcup
    O_n$, an open set covering $E$ and
    \[
      m^*(O\setminus E) \le \sum m^*(O_n\setminus E_n) < 2\vep.
    \]
    Hence, (i) implies (ii). Now we suppose (ii) holds and let $\vep_n=1/n$,
    then there exists a sequence of open sets $<O_n>$ such that $m^*(O_n
    \setminus E)<1/n$. Let $G=\bigcap O_n\in G_\delta$. $m^*(G\setminus E)\le
    m^*(O_n\setminus E)\le 1/n$. Since the left hand side is independent of
    $n$, $m^*(G\setminus E)=0$. If (iv) holds, then by Lemma 6, $G\setminus E$
    is measurable. Since $G\in G_\delta$ is also measurable, $E$ is measurable.
    Hence, (iv) implies (i).\par
    By the previous result, for any measurable $E$, there exists some closed set
    $F\subset E$ such that $\bar{F}$, which is open, contains $bar{E}$ and $m^*(
    \bar{F}\setminus \bar{E})<\vep$. Hence, $m^*(E\setminus F)<\vep$. We can
    proceed in a similar manner as we did in the last paragraph to prove that
    (iii) $\Rightarrow$ (v) $\Rightarrow$ (i), leading to the final conclusion.
  \end{proof}

% end

\setcounter{subsection}{4}
\subsection{Measurable Functions}
  \paragraph{19.}
  \begin{proof}
    For every $\beta\in\mathbb{R}$, since $D$ is measurable, there exists a
    sequence of $\alpha_n\in D\cap(\beta-1/n,\beta)$. As
    \[
      \{x:\, f(x)>r\} \quad\Leftrightarrow\quad
      \bigcup_{n=1}^\infty \{x:\, f(x)>r-1/n\} \quad\Leftrightarrow\quad
      \bigcup_{n=1}^\infty \{x:\, f(x)>\alpha_n\}
    \]
    and $\{x:\, f(x)>\alpha_n\}$ are measurable, so is $\{x:\, f(x)>r\}$. Hence,
    $f$ is measurable.
  \end{proof}

  \paragraph{21.}
  \begin{proof}
    $\,$\par
    (a) It follows immediately from $\{x:\, f(x)>\alpha\} = \{x\in D:\, f(x)>
    \alpha\}\cup \{x\in E:\, f(x)>\alpha\}$.\par
    (b) For $\alpha\ge 0$, the sets $\{x:\, f(x)>\alpha\}$ and $\{x:\, g(x)>
    \alpha\}$ are the same. And for $\alpha < 0$,
    \[
      \{x:\, f(x)>\alpha\} = \{x:\, g(x)>\alpha\} \setminus \bar{D}
      \quad\text{and}\quad
      \{x:\, g(x)>\alpha\} = \{x:\, f(x)>\alpha\} \cup \bar{D}.
    \]
    Hence, $f$ is measurable iff $g$ is measurable.
  \end{proof}

  \paragraph{22.(d)}
  \begin{proof}
    Since $f$ and $g$ are finite almost everywhere, the set $A$ consisting of
    points where $f+g$ is of the form $\infty - \infty$ or $-\infty + \infty$ is
    of measure zero (and hence measurable). Therefore no matter how it is
    defined, $\{x\in A:\,f+g>\alpha\}$ is measurable for every $\alpha$. Namely,
    the restriction of $f+g$ to $A$ is measurable. Meanwhile, clear that the
    restriction to $D\setminus A$ is measurable where $D$ is the domain of $f$.
    Hence, by Exercise 21, $f$ is measurable.
  \end{proof}

  \paragraph{23.}
  \begin{proof}
    $\,$\par
    (a) Let $A_n=\{x:\,|f(x)|>n\}$, a sequence of measurable sets. As $A_{n+1}
    \subset A_n$, $mA_{n+1}\le mA_n$. Since $A=\bigcap A_n = \{x:\,|f(x)|=\infty
    \}$, $mA_1\le m[a,b]$ is finite and $mA=0$, by Proposition 14, there exists
    some $N$ such that for all $n\ge N$, $mA_n<\vep/3$. Set $M=N$ to complete
    the proof.\par
    (b) We consider the restriction of $f$ on to the set $E=[a,b]\setminus\{x:\,
    |f(x)|\ge M\}$, which is also a measurable real-valued function. To keep our
    notation simple, we denote the restriction by $f$ still. For every $\vep>0$,
    there exists some integer $N$ with $0<2M/N<\vep$. Let $E_n=\{x:\,x\in
    [-M+(n-1)\vep, -M+n\vep]\}$ ($n=1,2,\dots,N$) and define
    \[
      \varphi(x) = \sum_{i=1}^N f(x_i)\chi_{E_i},
    \]
    where $x_n\in E_n$ is arbitrary. Clear that $\varphi$ is a simple function
    and satisfy all the requirements.\par
    (c) Suppose that $\varphi(x)=\sum_{i=1}^n \alpha_i\chi_{E_i}$. For each $i
    =1,\dots,N$, $E_i$ is measurable and therefore by Proposition 15, there
    exists a finite union $U_i$ of open intervals such that $m(U_i\bigtriangleup
    E_i)<\vep$. Let
    \[
      g(x) = \sum_{i=1}^N \alpha_i\chi_{U_i}.
    \]
    Clear that $g$ and $\varphi$ only may differ on a set with measure $N\vep$.
    (d) Suppose that $g(x)=\sum_{i=1}^N\alpha_i\chi_{U_i}$ is a step function.
    We may assume without loss of generality that $U_i$ are disjoint and
    $\bigcup U_i = [a,b]$. And suppose that $\{x_0=a < x_1 < \dots < x_N=b\}$
    are the endpoints of the intervals. For each $i=1,\dots,N-1$, define
    \[
      f(x) = (x-x_i+\vep)g(x_i-\vep) + (x_i+\vep - x)g(x_i+\vep),\quad
      x\in (x_i-\vep, x_i+\vep),
    \]
    and $f(x)=g(x)$ for the other points. (We assume that $\vep$ is small enough
    so that $f$ is well-defined.) Clear that $f$ is continuous and equals $g$
    except on a set of measure less then $2N\vep$.
  \end{proof}

  \paragraph{24.}
  \begin{proof}
    For measurable $f$, we show that $\mathcal{A}=\{E:\, f\inv[E]\text{ is
    measurable}\}$ is a $\sigma$-algebra first. As the domain, denoted by $D$,
    of a measurable function is measurable, $\mathbb{R}\in\mathcal{A}$. If
    $E\in\mathcal{A}$, then since $f\inv[\bar{E}]= D\cap \overline{f\inv[E]}$,
    $f\inv[\bar{E}]$ is also measurable and therefore $\bar{E}\in\mathcal{A}$.
    Suppose that $<E_n>$ is a sequence of sets of $\mathcal{A}$. Then, as
    \[
      f\inv\left[\bigcup_{n=1}^\infty E_n\right] =
      \bigcup_{n=1}^\infty f\inv[E_n],
    \]
    $\bigcup E_n\in\mathcal{A}$. Hence, $\mathcal{A}$ is a $\sigma$-algebra.\par
    By the definition of a measurable function, every open interval belongs to
    $\mathcal{A}$. Since the collection of all Borel sets $\mathcal{B}$ is the
    $\sigma$-algebra generated by all open intervals, $\mathcal{B}\subset
    \mathcal{A}$. Namely, $f\inv[B]$ is measurable as long as $B\in\mathcal{B}$.
  \end{proof}

% end

\subsection{Littlewood's Three Principles}
  \paragraph{30.}
  \begin{proof}
    Let $\vep_n=1/n$ and $\delta_n =\eta/2^n$ ($n=0,1,\dots$). By Proposition
    24, for each $n$, there exists some $A_n$ with measure less than $\delta_n$
    such that for all $x\in E_n\setminus A_n$, $|f_m(x) - f(x)|<\vep_n$ for $m$
    large enough. Let $A=\bigcup_{n=1}^\infty A_n$, the measure of which is less
    than $\sum \eta/2^n=\delta$. Meanwhile, for any $\vep>0$, by construction,
    for all $x\in E\setminus A$, $|f_m(x)-f(x)|<\vep$ for $m$ large enough.
    Namely, $f_n$ converges to $f$ uniformly on $E\setminus A$.
  \end{proof}

  \paragraph{31.}
  \begin{proof}
    Let $\vep_n=\delta/2^n$ ($n\ge 0$), then by Proposition 22, there exists
    continuous $g_n$ such that $E_n=\{x:\,|f(x)-g_n(x)|\ge\vep_n\}$ is of
    measure less than $\vep_n$. Let $E=\bigcup E_n$, the measure of which is
    less than $\delta$ and $g_n$ converges to $f$ on $[a,b]\setminus E$.\par
    By Egoroff's Theorem, there exists some $A\subset [a,b]\setminus E$ with $m
    A<\delta$ such that $g_n$ converges to $f$ uniformly on $[a,b]\setminus(E
    \cup A)]$. Since $E\cup A$ is measurable, by Proposition 15, there exists
    some open set $O\supset E\cup A$ such that $m(O\setminus(E\cup A))<\delta$.
    Let $F=[a,b]\setminus O$. We know that
    \begin{enumerate}
      \item $F$ is a closed set.
      \item $mF < 3\delta$.
      \item $g_n$ converges to $f$ uniformly on $F$.
    \end{enumerate}
    Hence, $f$ is continuous on $F$ And by Problem 2.40, there exists some
    continuous function on $\mathbb{R}$ such that $\varphi(x) = f(x)$ for $x\in
    F$.\par
    If $f$ is defined on $(-\infty,\infty)$, we can apply the previous result on
    each $[n,n+1]$ and "stick" the functions together as we did in Problem 23(c)
    to get the function required.
  \end{proof}
% end


\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{caption}
\usepackage{amsmath,amsfonts,amssymb}
\DeclareMathOperator{\e}{e}
\usepackage{geometry}
\usepackage{ulem}
\usepackage{comment}
\usepackage{enumitem}
\usepackage{amsmath}
\usepackage{systeme}
\usepackage{array}
\usepackage{float}
\usepackage{gensymb}
\usepackage{listings}
\usepackage{minted}
\usepackage{hyperref}
\usepackage{appendix}
\usepackage[dvipsnames]{xcolor}
\usepackage[nottoc,notlot,notlof]{tocbibind}
\usepackage{indentfirst}

\title{Time-Splitting Method}
\author{}
\date{}

\newcommand{\fder}[2]{\frac{\delta #1}{\delta f}\Bigr|_{#2}}
\newcommand{\fint}[3]{\int\fder{#1}{#2}#3(#2)}

\begin{document}

\maketitle

\subsection*{Justification of the Time-Splitting Method for non-linear operators}

Let $\mathcal{H}$ be a normed sub-vector space of smooth enough functions of $\mathcal{F}(\mathbb{R}^3,\mathbb{C})$, $f_0\in \mathcal{H}$, $A$ and $B$ (not necessarily linear) operators $\mathcal{H} \longmapsto \mathcal{H}$.\par
We are looking for $f:t\in \mathbb{R} \longmapsto f(t)\in \mathcal{H}$, such that (writing $f$ also for the function $(t,\mathbf{x}) \longmapsto f(t)(\mathbf{x})$):
\begin{equation}\label{initialEq}
    \partial_t f = A(f) + B(f)~~~~,~~~~\text{and} ~~ f(0)=f_0
\end{equation}
We want to solve this numerically. So, for fixed $t$ and small enough $\epsilon$, we want an approximation of $f(t+\epsilon)$ as a function of $f(t)$. Let $f^{(1)},f^{(2)},f^{(3)}\in \mathcal{H}$ such that:

\begin{equation}\label{TSM}
\begin{split}
    \partial_t f^{(1)} &= A(f^{(1)})~~~~,~~~~ f^{(1)}(0)=f(t)\\
    \partial_t f^{(2)} &= B(f^{(2)})~~~~,~~~~ f^{(2)}(0)=f^{(1)}(\frac{\epsilon}{2})\\
    \partial_t f^{(3)} &= A(f^{(3)})~~~~,~~~~ f^{(3)}(0)=f^{(2)}(\epsilon)
    \end{split}
\end{equation}

We are going to show that:
\begin{equation}\label{Theo}
    f(t+\epsilon)-f^{(3)}(\frac{\epsilon}{2}) ~=~ \mathcal{O}(\epsilon^3)
\end{equation}

For $\mathbf{x}\in \mathbb{R}^3$, we define the functionals $A_\mathbf{x} : g \longmapsto A(g)(\mathbf{x})\in \mathbb{C}$ and $B_\mathbf{x} : g \longmapsto B(g)(\mathbf{x})\in \mathbb{C}$. We will assume that for all $\mathbf{x}$, $A_\mathbf{x}$ and $B_\mathbf{x}$ are smooth enough so that their functional derivatives exist and they can be Taylor-expanded to the 1\textsuperscript{st} order:
\begin{equation}\label{Taylor}
    F(g+\epsilon h)=F(g)+\int\text{d}^3\mathbf{x}\fder{F}{g}(\mathbf{x})\epsilon h(\mathbf{x})+\mathcal{O}(\epsilon^2)
\end{equation}
for $F=A_\mathbf{x},B_\mathbf{x}$. It also follows that:
\begin{equation}\label{totalder}
    \frac{\text{d}}{\text{d}t}F(g(t))=\int\text{d}^3\mathbf{x}\fder{F}{g(t)}(\mathbf{x})~\partial_t g(t,\mathbf{x})
\end{equation}

Let $\mathbf{x}_0\in\mathbb{R}^3$. We have:
$$f(t+\epsilon,\mathbf{x}_0)=f(t,\mathbf{x}_0)+\epsilon\partial_t f(t,\mathbf{x}_0)+\frac{\epsilon^2}{2}\partial_t^2 f(t,\mathbf{x}_0)+\mathcal{O}(\epsilon^3)$$
From \eqref{initialEq} and using \eqref{totalder} we get:
\begin{equation}\label{Eqf}
    \begin{split}
    f(t+\epsilon,\mathbf{x}_0)=&f(t,\mathbf{x}_0)~+~\epsilon (A_{\mathbf{x}_0}+B_{\mathbf{x}_0})(f(t))\\
    &+\frac{\epsilon^2}{2}\int \text{d}^3\mathbf{x}\left[ \fder{A_{\mathbf{x}_0}}{f(t)}(\mathbf{x})+\fder{B_{\mathbf{x}_0}}{f(t)}(\mathbf{x}) \right]~ (A_{\mathbf{x}_0}+B_{\mathbf{x}_0})(f(t))(\mathbf{x}) ~+~\mathcal{O}(\epsilon^3)
    \end{split}
\end{equation}
In the following we will drop the $\mathbf{x}_0$, keeping in mind that the equations have in fact the form of \eqref{Eqf}.\par

Let us now compute $f^{(3)}(\frac{\epsilon}{2})$. We will use \eqref{TSM}, \eqref{Taylor} and \eqref{totalder} and keep only 2\textsuperscript{nd} order terms in $\epsilon$ at most.
\small
\begin{align*}
        f^{(3)}(\frac{\epsilon}{2})&=f^{(3)}(0)+\epsilon\partial_t f^{(3)}(0)+\frac{\epsilon^2}{8}\partial_t^2f^{(3)}(0)+\mathcal{O}(\epsilon^3)\\
        &= f^{(3)}(0) + \frac{\epsilon}{2}A(f^{(3)}(0)) + \frac{\epsilon^2}{8}\int \fder{A}{f^{(3)}(0)}A(f^{(3)}(0))~+~\mathcal{O}(\epsilon^3)
\end{align*}
\normalsize
We have {\scriptsize $f^{(3)}(0)=f^{(2)}(\epsilon)=f^{(2)}(0)+\epsilon\partial_t f^{(2)}(0)+\frac{\epsilon^2}{2}\partial_t^2f^{(2)}(0)+\mathcal{O}(\epsilon^3)$}. So, Taylor-expanding:
\small
\begin{align*}
        f^{(3)}(\frac{\epsilon}{2})&= f^{(2)}(0)+\epsilon\partial_t f^{(2)}(0)+\frac{\epsilon^2}{2}\partial_t^2f^{(2)}(0) + \frac{\epsilon}{2}\left(A(f^{(2)}(0)+\int \fder{A}{f^{(2)}(0)}\epsilon\partial_t f^{(2)}(0)\right)\\
        &\qquad \qquad \qquad+ \frac{\epsilon^2}{8}\int \fder{A}{f^{(2)}(0)}A(f^{(2)}(0)) ~+~\mathcal{O}(\epsilon^3)\\
        &=f^{(2)}(0)+\epsilon\left[B(f^{(2)}(0)+\frac{1}{2}A(f^{(2)}(0)\right]\\
        &\qquad +\frac{\epsilon^2}{2}\left[\fint{B}{f^{(2)}(0)}{B}+\fint{A}{f^{(2)}(0)}{B}+\frac{1}{4}\fint{A}{f^{(2)}(0)}{A}\right]~+~\mathcal{O}(\epsilon^3)
\end{align*}
\normalsize
Again we have {\scriptsize $f^{(2)}(0)=f^{(1)}(\frac{\epsilon}{2})=f^{(1)}(0)+\frac{\epsilon}{2}\partial_t f^{(1)}(0)+\frac{\epsilon^2}{8}\partial_t^2f^{(1)}(0)+\mathcal{O}(\epsilon^3)$}, so:
\small
\begin{align*}
        f^{(3)}(\frac{\epsilon}{2})&= f^{(1)}(0)+\frac{\epsilon}{2}\partial_t f^{(1)}(0)+\frac{\epsilon^2}{8}\partial_t^2f^{(1)}(0)\\&\qquad+ \epsilon\left(B(f^{(1)}(0))+\int \fder{B}{f^{(1)}(0)}\frac{\epsilon}{2}\partial_t f^{(1)}(0)+\frac{1}{2}A(f^{(1)}(0))+\frac{1}{2}\int \fder{A}{f^{(1)}(0)}\frac{\epsilon}{2}\partial_t f^{(1)}(0)\right)\\
        &\qquad \qquad + \frac{\epsilon^2}{2}\left(\fint{B}{f^{(1)}(0)}{B}+\fint{A}{f^{(1)}(0)}{B}+\frac{1}{4}\fint{A}{f^{(1)}(0)}{A}\right) ~+~\mathcal{O}(\epsilon^3)
\end{align*}
\normalsize
Gathering terms, we get:
\begin{equation}\label{Eqf3}
    \begin{split}
    f^{(3)}(\frac{\epsilon}{2})=& f^{(1)}(0)~+~\epsilon (A+B)(f^{(1)}(0))\\
    &+\frac{\epsilon^2}{2}\int \left[ \fder{A}{f^{(1)}(0)}+\fder{B}{f^{(1)}(0)} \right]~ (A+B)(f^{(1)}(0)) ~+~\mathcal{O}(\epsilon^3)
    \end{split}
\end{equation}
Since $f^{(1)}(0)=f(t)$, we see that the expression is the same as \eqref{Eqf}. Hence we proved \eqref{Theo}.

\end{document}


\documentclass{article}

\usepackage{amsmath}

\title{Sample \LaTeX -document}
\author{Michael Thumand}

\begin{document}

\maketitle

\section{Introduction}

Here is an example of in-line use of math $a\otimes b = c$ and here the text continues. Below this paragraph is another example of a math equation:

\begin{equation}
E=mc^2
\end{equation}

\begin{equation}
a^2 + b^2 = c^2
\end{equation}

\end{document}


\documentclass[10pt]{article}

\usepackage{fullpage}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{tikz}

\usepackage{clrscode3e}

\usepackage{enumitem}
%\usepackage{parskip}
%\setlist{parsep=8pt,listparindent=\parindent}
\setlength\parindent{0pt}
\setlength\parskip{6pt}

\newtheorem{lemma}{Lemma}
\newtheorem{corollary}{Corollary}
\newtheorem{proposition}{Proposition}

\begin{document}

\noindent CSC373 Assignment 1 \hfill Eric Bannatyne\\
24 February 2015 \hfill 1000468451\\

The following algorithm updates the given minimum spanning tree \(T\) of \(G\), to produce a new minimum spanning tree \(T_1\) for \(G_1\).

\begin{codebox}
\Procname{\(\proc{Update-MST}(V, E, w, T, e_1, w_1)\)}
%\li \(E_1 = E \cup \{e_1\}\)
%\li \(G_1 = (V, E_1)\)
\li \(T_1 = T \cup \{e_1\}\)
\li \(D = \) DFS tree produced by DFS on \(T_1\) starting from \(u\), including information about back edges \Comment CLRS p. 610

\li \(e = \const{nil}\)
\li \(\id{weight} = 0\)
\li \Comment Find the (unique) back edge of \(D\).
\li \Comment This must have \(u\) as an endpoint since \(e_1\) is in the cycle and DFS was started at \(u\).
\li \For \(x\) in \(u.\id{neighbours}\) \Comment Neighbours in \(T_1\)
	\Do
	\li \If \(\{x, u\}\) is a back edge of \(D\)
		\Then
		\li \(e = \{x, u\}\)
		\li \(\id{weight} = w(e)\)
		\li \textbf{break}
		\End
	\End

\li \Comment Traverse up along the cycle in the DFS tree until the root \(u\) is reached,
\li \Comment keeping track of the maximum-weight edge.
\li \While \(x \neq u\)
	\Do
	\li \If \(w(\{x, x.\id{parent}\}) > \id{weight}\) \Comment \(x.\id{parent}\) in \(D\)
		\Then
		\li \(e = \{x, x.\id{parent}\}\)
		\li \(\id{weight} = w(e)\)
		\End
	\li \(x = x.\id{parent}\)
	\End
\li \(T_1 = T_1 - \{e\}\)
\li \Return \(T_1\)
\end{codebox}

\subsection*{Correctness}

On a high level, this algorithm updates \(T\) by inserting the new edge \(e_1 = \{u, v\}\) into \(T\). This produces exactly one cycle in the graph \(T \cup \{e_1\}\) (Result given on Piazza). The algorithm then finds and removes the maximum-weight edge \(e\) from the cycle, to produce a new tree \(T_1 = T \cup \{e_1\} - \{e\}\). This is, in fact, a spanning tree, since the removed edge \(e\) is on a cycle, meaning that neither of the endpoints of \(e\) become isolated vertices when \(e\) is removed. We will show that \(T_1\) is in fact a minimum spanning tree.

By definition, we have \(w(T_1) = w(T \cup \{e_1\} - \{e\}) = w(T) + w(e_1) - w(e)\). However, since \(e\) is a maximum-weight vertex on its cycle in \(T \cup \{e_1\}\) and \(e_1\) lies on that cycle, we have \(w(e_1) \leq w(e)\), which implies that \(w(T) \geq w(T_1)\).

To show that the spanning tree that this algorithm produces is indeed a minimum spanning tree of \(G_1\), suppose that \(T_1\) is not a MST. Then since \(G_1\) is connected, there must be some MST \(T_1'\) for \(G_1\) such that \(w(T_1') < w(T_1)\). We have two cases to consider, depending on whether or not \(T_1'\) contains \(e_1\).

If \(e_1 \notin T_1'\), then \(T_1'\) must be a spanning tree for \(G\), which means that \(w(T) \leq w(T_1')\). However, since we established that \(w(T_1) \leq w(T) \leq w(T_1')\), this contradicts our assumption that \(w(T_1') < w(T_1)\). Therefore \(T_1\) must also be a minimum spanning tree.

Now suppose that \(e_1 \in T_1'\). Removing \(e_1 = \{u, v\}\) from \(T_1'\) must disconnect the tree, such that \(T_1' - \{e_1\}\) contains exactly two connected components \(A = (V_A, E_A)\) and \(B = (V_B, E_B)\), such that \(u \in V_A\) and \(v \in V_B\). Let \(C\) be the unique cycle contained in \(T \cup \{e_1\}\). It will be helpful to prove the following lemma.

\begin{lemma}There is some edge \(e' = \{a, b\} \in C - \{e_1\}\) such that \(a \in V_A\) and \(b \in V_B\).\end{lemma}
\begin{proof}
Since \(C\) is a cycle, \(C - \{e_1\}\) must be a connected subgraph of \(T\) which is a chain of the form \[u = w_1 \longleftrightarrow w_2 \longleftrightarrow \dots \longleftrightarrow w_k = v, \] where ``\(\longleftrightarrow\)'' denotes ``is adjacent to (in \(C - \{e_1\}\))''. Since \(V_A \cap C\) and \(V_B \cap C\) form a partition of the vertices included in \(C\), and we know that \(u \in V_A\) and \(v \in V_B\), there must be some \(i\) such that \(w_i \in V_A\) and \(w_{i+1} \in V_B\). Choosing \(e' = \{w_i, w_{i+1}\}\) completes the proof.
\end{proof}

This means that, if we remove \(e_1\) from \(T_1'\), there must be some edge \(e'\) in \(C - \{e_1\}\) such that \(T_1' - \{e_1\} \cup \{e'\}\) is a spanning tree of \(G\). Since \(e' \in C\), we know that \(w(e') \leq w(e)\), where \(e\) is the edge that the algorithm chose to remove from the cycle when producing \(T_1\). Thus, we have \begin{align*}
w(T) &\leq w(T_1') - w(e_1) + w(e') \\
&< w(T_1) - w(e_1) + w(e') \\
&\leq w(T_1) - w(e_1) + w(e) \\
&= w(T_1 - \{e_1\} \cup \{e\}) \\
&= w(T).
\end{align*}

Thus, \(w(T) < w(T)\), which is a contradiction. Therefore \(T_1\) must be a minimum spanning tree of \(G_1\).

\subsection*{Running Time}

We now analyze the running time of \proc{Update-MST}. Performing depth-first search to obtain the DFS tree \(D\) requires \(\Theta(|V| + m)\) steps, where \(m\) is the number of edges in \(T \cup \{e\}\). However, since \(T\) is a spanning tree of \(G\), it contains \(|V| - 1\) edges, so \(m = |V|\), and so this step really only requires \(\Theta(|V|)\) time.

The rest of the algorithm proceeds by examining the neighbours of \(u\) in \(T \cup \{e_1\}\) to find a back edge, and then traversing a single cycle of \(T \cup \{e_1\}\), both of which are bounded above by \(O(|T|) = O(V|)\) operations, as before. Therefore \proc{Update-MST} runs in \(\Theta(|V|)\) time in the worst case, an improvement over using the standard algorithms to produce a new minimum spanning tree from scratch.

\end{document}

CS/CSC373/files of other terms/CSC373 2009-2019/2015/assignments/assignment 1/my work/a1q1a.tex


    \filetitle{SVAR}{Convert reduced-form VAR to structural VAR}{SVAR/SVAR}

	\paragraph{Syntax}\label{syntax}

\begin{verbatim}
[S,DATA,B,COUNT] = SVAR(V,DATA,...)
\end{verbatim}

\paragraph{Input arguments}\label{input-arguments}

\begin{itemize}
\item
  \texttt{V} {[} VAR {]} - Reduced-form VAR object.
\item
  \texttt{DATA} {[} struct \textbar{} tseries {]} - Data associated with
  the input VAR object.
\end{itemize}

\paragraph{Output arguments}\label{output-arguments}

\begin{itemize}
\item
  \texttt{S} {[} VAR {]} - Structural VAR object.
\item
  \texttt{DATA} {[} struct \textbar{} tseries {]} - Data with
  transformed structural residuals.
\item
  \texttt{B} {[} numeric {]} - Impact matrix of structural residuals.
\item
  \texttt{COUNT} {[} numeric {]} - Number of draws actually performed
  (both successful and unsuccessful) when \texttt{'method'='draw'};
  otherwise \texttt{COUNT=1}.
\end{itemize}

\paragraph{Options}\label{options}

\begin{itemize}
\item
  \texttt{'maxIter='} {[} numeric \textbar{} \emph{\texttt{0}} {]} -
  Maximum number of attempts when \texttt{'method'='draw'}.
\item
  \texttt{'method='} {[} \emph{\texttt{'chol'}} \textbar{}
  \texttt{'householder'} \textbar{} \texttt{'qr'} \textbar{}
  \texttt{'svd'} {]} - Method that will be used to identify structural
  VAR and structural shocks.
\item
  \texttt{'nDraw='} {[} numeric \textbar{} \emph{\texttt{0}} {]} -
  Target number of successful draws when \texttt{'method'='draw'}.
\item
  \texttt{'reorder='} {[} numeric \textbar{} \emph{empty} {]} - Reorder
  VAR variables before identifying structural shocks, and bring the
  variables back in original order afterwards. Use the option
  '\texttt{backorderResiduals='} to control if also the structural
  shocks are to be brought back in original order.
\item
  \texttt{'output='} {[} \emph{\texttt{'auto'}} \textbar{}
  \texttt{'dbase'} \textbar{} \texttt{'tseries'} {]} - Format of output
  data.
\item
  \texttt{'progress='} {[} \texttt{true} \textbar{}
  \emph{\texttt{false}} {]} - Display progress bar in the command
  window.
\item
  \texttt{'rank='} {[} numeric \textbar{} \emph{\texttt{Inf}} {]} -
  Reduced rank of the covariance matrix of structural residuals when
  \texttt{'method=' 'svd'}; \texttt{Inf} means full rank is preserved.
\item
  \texttt{'backOrderResiduals='} {[} \emph{\texttt{true}} \textbar{}
  \texttt{false} {]} - Bring the identified structural shocks back in
  original order after identification; works with \texttt{'reorder='}.
\item
  \texttt{'std='} {[} numeric \textbar{} \emph{\texttt{1}} {]} - Std
  deviation of structural residuals; the resulting structural covariance
  matrix will be re-scaled (divided) by this factor.
\item
  \texttt{'test='} {[} char {]} - Works with \texttt{'method=draw'}
  only; a string that will be evaluated for each random draw of the
  impact matrix \texttt{B}. The evaluation must result in \texttt{true}
  or \texttt{false}; only the matrices \texttt{B} that evaluate to
  \texttt{true} will be kept. See Description for more on how to write
  the option \texttt{'test='}.
\end{itemize}

\paragraph{Description}\label{description}

\subparagraph{Identification random Householder
transformations}\label{identification-random-householder-transformations}

The structural impact matrices \texttt{B} are randomly generated using a
Householder transformation algorithm. Each matrix is tested by
evaluating the \texttt{test} string supplied by the user. If it
evaluates to true the matrix is kept and one more SVAR parameterisation
is created, if it is false the matrix is discarded.

The \texttt{test} string can refer to the following characteristics:

\begin{itemize}
\item
  \texttt{S} -- the impulse (or shock) response function; the
  \texttt{S(i,j,k)} element is the response of the \texttt{i}-th
  variable to the \texttt{j}-th shock in period \texttt{k}.
\item
  \texttt{Y} -- the asymptotic cumulative response function; the
  \texttt{Y(i,j)} element is the asumptotic (long-run) cumulative
  response of the \texttt{i}-th variable to the \texttt{j}-th shock.
\end{itemize}

\paragraph{Example}\label{example}


% Results
\chapter{Results}
\label{ch:results}
%\epigraphhead{\epigraph{
%Usability answers the question, ``Can the user accomplish their goal?''}{\textsc{Joyce Lee}}}
The numerical results of the experiments and the analyses are shown for each experiment type.
Their \glspl{hpd} are not shown in the table, but they are mentioned when needed.
The difference of means, the \gls{pm} on one side of zero, and the effect sizes (Hedges's \sym{effect}) are shown.
As a general rule of thumb, an effect can be considered statistically significant at a desired level if the \gls{ci} does not contain zero, or, equivalently, if the reported \gls{pm} is greater than 95\%.
Values of 0.2, 0.5, and 0.8 can be considered small, medium, and large effects respectively.\cite{sawilowsky2009new}

  \section{Path length}
  \fref{fig:paths_overview} shows the paths flown by the operators, as well as the locations at which they arrived.
  The target is the coloured rectangle, while the dashed line represents the area within which one part of the drone would be over the target.

  \begin{figure}[h]
    \centering
    \input{img/plots/paths_overview.pgf}
    \caption[Paths overview]{Overview of the paths flown by the operators and their arrival locations.}
    \label{fig:paths_overview}
  \end{figure}

  All \gls{spirit} subjects confirmed that they were able to see the target, as well as their relative position in \sym{posx}, but many had difficulty estimating their position in \sym{posy}.
  This can be seen by the amount of paths which overfly the target area completely compared to the onboard view.
  It seems notable that onboard pilots erred on the side of caution and undershot their approach.
  This may be due to the fact that the target disappears earlier when using the onboard view, and, with no depth perception, the user cannot rely on environmental cues.

  The tendency of the drone to yaw to the right can clearly be seen, where users initially start out by moving to the right before correcting their path.
  In addition, \gls{spirit} users tend to take a more consistent route to their destination, and stay in a more narrow zone.
  This might indicate that they are more comfortable with the interface.

  The path length is shown in \fref{fig:movement}, and the summary is shown in \tref{tab:movement}.

  \begin{figure}[h]
    \centering
    \input{img/plots/movement.pgf}
    \caption[Path lengths]{Path length, including total movement in \sym{posx} and \sym{posy}.}
    \label{fig:movement}
  \end{figure}

  \begin{table}[h]
    \centering
    \caption[Path length summary]{Summary of the path length.}
    \begin{tabular}{lrrrrrrr}
      \toprule
      & \multicolumn{2}{c}{Onboard} & \multicolumn{2}{c}{\gls{spirit}} \\
      & $\sym{mean}$ & $\sym{std}$ & $\sym{mean}$ & $\sym{std}$ & $\Delta\sym{mean}$ & \gls{pm} & \sym{effect} \\
      \midrule
      Path length (m) & 10.849 & 2.727 & 11.914 & 2.706 & $-1.049$ & 87.0\% & $-0.390$ \\
      Movement in $\sym{posx}$ (m) & 2.862 & 1.055 & 2.944 & 1.014 & $-0.078$ & 58.3\% & $-0.078$\\
      Movement in $\sym{posy}$ (m) & 1.043 & 0.573 & 1.268 & 0.687 & $-0.220$ & 82.7\% & $-0.360$\\
      \bottomrule
    \end{tabular}
    \label{tab:movement}
  \end{table}

  An ideal run with zero wasted motion would have a total path length of 6.0\,m.
  However, the mean path length for runs using the onboard view was $10.849 \pm 2.727$\,m, while that for \gls{spirit} runs was $11.914 \pm 2.706$\,m.
  That is, \gls{spirit} users flew 1.05\,m longer than their onboard counterparts.
  It appears that there is a small effect size (\sym{effect}=$-0.390$), but the \gls{pm} is only 87.0\%.

  There was almost no difference ($-0.078$\,m) in total motion in the \sym{posx} direction, but there was a small, nonsignificant correlation in \sym{posy} ($\Delta$\sym{mean}=$-0.220$\,m, \sym{effect}=$-0.360$, \gls{pm}=82.7\%).

  From \fref{fig:movement_runs}, it appears that the first and third \gls{spirit} flights produced longer path lengths.
  In both these cases, the operator was using the system for the first time.
  Towards the end of that first flight, and continuing into their next attempt, the path lengths are comparable to those flown with the onboard view.
  This may be a statistical aberration, or it could be the effect of familiarity with the system.

  \begin{figure}[h]
    \centering
    \input{img/plots/movement_runs.pgf}
    \caption[Path lengths across runs]{The change in path length across runs. The movement in \sym{posx} and \sym{posy} was larger with \gls{spirit} on the first and third runs, but is similar in subsequent runs.}
    \label{fig:movement_runs}
  \end{figure}

  \section{Accuracy}
  \fref{fig:paths_detailed} shows the location of all the arrival points in each of the groups with respect to the target.

  \begin{figure}[h]
    \centering
    \input{img/plots/paths_detailed.pgf}
    \caption[Arrival overview]{Detail of the arrival points with respect to the target. Lighter points represent later runs.}
    \label{fig:paths_detailed}
  \end{figure}

  Out of the eighteen arrivals, none of the onboard ones are directly above the target, and only seven had a portion of the drone above the target.
  The distribution is very wide and not precise, and was slightly semicircular.
  Some students have commented that they were using a motion capture camera pole as a marker, and orienting themselves around that.

  By contrast, \gls{spirit} operators obtained a much more consistent result, with both higher accuracy and precision.
  Four out of eighteen were directly above the target, and a further eight had a portion of the drone above the target.
  This distribution is much more concentrated.

  \fref{fig:distance} shows the distance from the target at the time of arrival.
  The data is summarized in \tref{tab:distance}.
  As with the paths, people using the onboard view had a strong backward bias, with a mean of $-0.471$\,m.
  The 95\% \gls{hpd} was between $-0.737$ and $-0.227$\,m, which is completely outside the target's \sym{posy}-region.
  They also had a large standard deviation in \sym{posx} despite having a mean close to the centre (\sym{mean}=0.041\,m, \sym{std}=0.428\,m).

  \begin{figure}[h]
    \centering
    \input{img/plots/distance.pgf}
    \caption[Arrival distance]{Distance from target, including in \sym{posx} and \sym{posy}, at the time of arrival.}
    \label{fig:distance}
  \end{figure}

  \begin{table}[h]
    \centering
    \caption[Arrival distance summary]{Summary of the arrival distance in \sym{posx} and \sym{posy}.}
    \begin{tabular}{lrrrrrrr}
      \toprule
      & \multicolumn{2}{c}{Onboard} & \multicolumn{2}{c}{\gls{spirit}} \\
      & $\sym{mean}$ & $\sym{std}$ & $\sym{mean}$ & $\sym{std}$ & $\Delta\sym{mean}$ & \gls{pm} & \sym{effect} \\
      \midrule
      \sym{posx}-position (m) & 0.041 & 0.428 & 0.138 & 0.170 & $-0.100$ & 76.2\% & $-0.345$ \\
      \sym{posy}-position (m)* & $-0.471$ & 0.445 & $-0.071$ & 0.364 & $-0.396$ & 98.3\% & $-1.000$ \\
      \bottomrule
    \end{tabular}
    \label{tab:distance}
  \end{table}

  Meanwhile, the \gls{spirit} view had a strong rightward bias, with a mean of 0.138\,m.
  Nevertheless, the 95\% \gls{hpd} of 0.038 to 0.237\,m is completely above the target.
  On the other hand, while the mean of the \sym{posy} error ($-0.071$\,m) is above the target, its large standard deviation of 0.364\,m means that the users can be off-target by up to about one target length (95\% \gls{hpd}: $-0.293$ to 0.149\,m).

  \glspl{rmse} for \sym{posx} and \sym{posy} are shown in \fref{fig:rmse}, and summarized in \tref{tab:rmse}.
  The total \gls{rmse} was almost identical to the total distance shown in \fref{fig:distance}, and are thus treated as one in the analysis below.

  \begin{figure}[h]
    \centering
    \input{img/plots/rms.pgf}
    \caption[Arrival RMS Error]{\gls{rmse} in distance from target, including in \sym{posx} and \sym{posy} at the time of arrival.}
    \label{fig:rmse}
  \end{figure}

  \begin{table}[h]
    \centering
    \caption[Arrival RMSE summary]{Summary of the arrival \gls{rmse}.}
    \begin{tabular}{lrrrrrrr}
      \toprule
      & \multicolumn{2}{c}{Onboard} & \multicolumn{2}{c}{\gls{spirit}} \\
      & $\sym{mean}$ & $\sym{std}$ & $\sym{mean}$ & $\sym{std}$ & $\Delta\sym{mean}$ & \gls{pm} & \sym{effect} \\
      \midrule
      \acrshort{rmse} (m)* & 0.667 & 0.287 & 0.403 & 0.237 & 0.265 & 98.5\% & 1.059 \\
      \acrshort{rmse}$_{\sym{posx}}$ (m)* & 0.337 & 0.190 & 0.191 & 0.121 & 0.147 & 98.0\% & 0.958 \\
      \acrshort{rmse}$_{\sym{posy}}$ (m)* & 0.521 & 0.293 & 0.339 & 0.222 & 0.184 & 95.2\% & 0.737 \\
      \bottomrule
    \end{tabular}
    \label{tab:rmse}
  \end{table}

  While the onboard view had an error of $0.667\pm0.287$\,m, \gls{spirit} had an error of only $0.403\pm0.237$\,m.
  Broken down, the \sym{posx}- and \sym{posy}-\glspl{rmse} for the onboard view were $0.337\pm0.190$\,m and $0.521\pm0.293$\,m respectively.
  This compares to just $0.191\pm0.121$\,m and $0.339\pm0.222$\,m for \gls{spirit}, respectively.

  The difference is significant and the effect is large for the total distance ($\Delta$\sym{mean}=0.265\,m, \sym{effect}=1.059, \gls{pm}=98.5\%) and \gls{rmse}$_{\sym{posx}}$ ($\Delta$\sym{mean}=0.147\,m, \sym{effect}=0.958, \gls{pm}=98.0\%).
  They are signifanct and medium, respectively, for \gls{rmse}$_{\sym{posy}}$ ($\Delta$\sym{mean}=0.184\,m, \sym{effect}=0.737, \gls{pm}=95.2\%).

  \fref{fig:rms_runs} shows the change in the \glspl{rmse} across runs.
  It is consistently lower with \gls{spirit}, apart for the second run, which is slightly higher than the onboard view.
  This may be an aberration, given the low amount of participants.

  \begin{figure}[h]
    \centering
    \input{img/plots/rms_runs.pgf}
    \caption[Arrival RMS Error across runs]{Arrival \gls{rmse} change across runs.}
    \label{fig:rms_runs}
  \end{figure}

  \section{Duration}
  \fref{fig:duration_result} shows the duration of each type of experiment, and the data is summarized in \tref{tab:duration}.
  \gls{spirit} seemed to have a longer duration, but with less spread.
  In fact, the onboard view has a mean duration of 39.265\,s, and a standard deviation of 18.984\,s, while \gls{spirit} has $44.181\pm15.140$\,s.

  This difference, though, is not signficant, and the effect size is small. For duration, $\Delta$\sym{mean}=$-4.841$\,s, \sym{effect}=$-0.294$, \gls{pm}=78.1\%.

  \begin{figure}[h]
    \centering
    \begin{subfigure}[b]{0.45\textwidth}
      \input{img/plots/duration.pgf}
      \caption{Duration of each type of experiment.}
      \label{fig:duration_result}
    \end{subfigure}
    \hfill
    \begin{subfigure}[b]{0.45\textwidth}
      \input{img/plots/duration_runs.pgf}
      \caption{Change in duration across runs.}
      \label{fig:duration_runs}
    \end{subfigure}
    \caption[Duration]{The duration of the flight, from takeoff until the arrival button was pressed.}
    \label{fig:duration}
  \end{figure}

  \begin{table}[h]
    \centering
    \caption[Duration summary]{Summary of the duration.}
    \begin{tabular}{lrrrrrrr}
      \toprule
      & \multicolumn{2}{c}{Onboard} & \multicolumn{2}{c}{\gls{spirit}} \\
      & $\sym{mean}$ & $\sym{std}$ & $\sym{mean}$ & $\sym{std}$ & $\Delta\sym{mean}$ & \gls{pm} & \sym{effect} \\
      \midrule
      Duration (s) & 39.265 & 18.984 & 44.181 & 15.140 & $-4.841$ & 78.1\% & $-0.294$ \\
      \bottomrule
    \end{tabular}
    \label{tab:duration}
  \end{table}

  Looking at \fref{fig:duration_runs}, the difference between the durations decreased in each run, and \gls{spirit} was faster by the fourth run.
  This could be indicative of ease of learning, since the improvements were being made faster than with the onboard version.
  Further experimentation is needed to verify this hypothesis.
  For example, if the users are given a longer training session on a different course, they would have already gotten used to the system.

  \section{Workload}
  \fref{fig:tlx} shows the result of the \gls{nasatlx} survey, both in aggregate and by component.
  Because the \gls{tlx} responses are subjective, and the scale itself is an ordinal rather than interval scale, no actionable information can be gleaned from this small a sample size.\cite{hart2006}
  Instead, general trends may be observed.

  The six components in \fref{fig:tlx_components} are, in order:

  \begin{itemize}
    \item \textbf{\acrshort{mental}:} \acrlong{mental}
    \item \textbf{\acrshort{physical}:} \acrlong{physical}
    \item \textbf{\acrshort{temporal}:} \acrlong{temporal}
    \item \textbf{\acrshort{performance}:} \acrlong{performance}
    \item \textbf{\acrshort{effort}:} \acrlong{effort}
    \item \textbf{\acrshort{frustration}:} \acrlong{frustration}
  \end{itemize}

  \noindent and the weighted score is \acrshort{tlxscore}.

  Most onboard pilots who had a high score for physical demand mentioned that it was due to the fact that they needed to move in short burts to keep from hitting their surroundings.
  Since the frame rate was so low, the drone would move a significant distance by the time a frame updated.
  This raised stress and caused some frustration.

  Inherent issues in the system, such as with the drone's tendency to drift right, or the lack of depth perception, also contributed to frustration and mental demand, but it had a similar effect when using either system.

  \begin{figure}[h]
    \centering
    \begin{subfigure}[b]{0.45\textwidth}
      \input{img/plots/tlx_results.pgf}
      \caption{\gls{nasatlx} aggregate results.}
      \label{fig:tlx_results}
    \end{subfigure}
    \hfill
    \begin{subfigure}[b]{0.45\textwidth}
      \input{img/plots/tlx_components.pgf}
      \caption{\gls{nasatlx} component analysis.}
      \label{fig:tlx_components}
    \end{subfigure}
    \caption[NASA-TLX results]{Results for the \gls{nasatlx} survey.}
    \label{fig:tlx}
  \end{figure}

  The data is summarized in \tref{tab:tlx_summary}.

  \begin{table}[h]
    \centering
    \caption[NASA-TLX data summary]{The summary of the \gls{nasatlx} data.}
    \begin{tabular}{lrrrrrrrr}
      \toprule
      & \multicolumn{2}{c}{Onboard} & \multicolumn{2}{c}{\gls{spirit}} \\
      & $\sym{mean}$ & $\sym{std}$ & $\sym{mean}$ & $\sym{std}$
      & $\Delta\sym{mean}$ & $t$ & \sym{pvalue} & \sym{effect} \\
      \midrule
      \acrshort{mental}      &  29.000 & 15.922 & 24.222 & 17.908
      &  $-4.778$ & $-1.29269$ & 0.23220 & $-0.253$\\
      \acrshort{physical}    &   7.556 & 12.885 &  1.111 &  2.261
      &  $-6.444$ & $-1.81051$ & 0.10781 & $-0.626$\\
      \acrshort{temporal}    &  15.667 & 19.339 &  5.333 &  3.808
      & $-10.333$ & $-1.73228$ & 0.12146 & $-0.666$\\
      \acrshort{performance} &  27.222 & 16.998 & 16.667 &  8.902
      & $-10.556$ & $-1.64399$ & 0.13880 & $-0.699$\\
      \acrshort{effort}      &  32.667 & 19.755 & 20.111 & 10.167
      & $-12.556$ & $-2.19108$ & 0.05982 & $-0.718$\\
      \acrshort{frustration} &  23.556 & 22.328 & 17.333 & 15.149
      &  $-6.222$ & $-1.28600$ & 0.23441 & $-0.293$\\
      \acrshort{tlxscore}*    & 135.667 & 56.214 & 84.778 & 34.662
      & $-50.889$ & $-2.77594$ & 0.02408 & $-0.978$\\
      \bottomrule
    \end{tabular}
    \label{tab:tlx_summary}
  \end{table}

  A large, significant reduction of 35.74\% in the weighted \gls{tlx} score was seen.
  Analysis of the components show that the scores decreased across the board.
  There was a medium to high effect for physical (\sym{effect}=$-0.626$), temporal (\sym{effect}=$-0.666$), performance (\sym{effect}=$-0.699$), effort (\sym{effect}=$-0.718$), and overall score (\sym{effect}=$-0.978$).

  \section{Survey}
  The six components in \fref{fig:survey_components} are, in order:

  \begin{itemize}
    \item \textbf{\acrshort{oraware}:} \acrlong{oraware}
    \item \textbf{\acrshort{orcontrol}:} \acrlong{orcontrol}
    \item \textbf{\acrshort{posaware}:} \acrlong{relaware}
    \item \textbf{\acrshort{poscontrol}:} \acrlong{poscontrol}
    \item \textbf{\acrshort{relaware}:} \acrlong{relaware}
    \item \textbf{\acrshort{relcontrol}:} \acrlong{relcontrol}
  \end{itemize}

  \noindent and the survey score is \acrshort{surveyscore}.

  \fref{fig:survey} shows the result of the survey.
  Again, scores increased for each category.

  \begin{figure}[h]
    \centering
    \begin{subfigure}[b]{0.45\textwidth}
      \input{img/plots/survey_results.pgf}
      \caption{Survey aggregate results.}
      \label{fig:survey_results}
    \end{subfigure}
    \hfill
    \begin{subfigure}[b]{0.45\textwidth}
      \input{img/plots/survey_components.pgf}
      \caption{Survey component analysis.}
      \label{fig:survey_components}
    \end{subfigure}
    \caption[Survey results]{Results for the survey.}
    \label{fig:survey}
  \end{figure}

  The data is summarized in \tref{tab:survey_summary}.

  \begin{table}[h]
    \centering
    \caption[Survey data summary]{The summary of the survey data.}
    \begin{tabular}{lrrrrrrrr}
      \toprule
      & \multicolumn{2}{c}{Onboard} & \multicolumn{2}{c}{\gls{spirit}} \\
      & $\sym{mean}$ & $\sym{std}$ & $\sym{mean}$ & $\sym{std}$
      & $\Delta\sym{mean}$ & $t$ & \sym{pvalue} & \sym{effect} \\
      \midrule
      \acrshort{oraware} & 4.111 & 1.269 & 4.333 & 1.323
      &  0.222 & 0.32552 & 0.75314 & 0.154\\
      \acrshort{orcontrol} & 4.000 & 1.581 & 4.222 & 1.302
      &  0.222 & 0.29251 & 0.77734 & 0.138\\
      \acrshort{posaware}* & 3.222 & 1.202 & 4.667 & 1.000
      &  1.444 & 2.87122 & 0.02079 & 1.173\\
      \acrshort{poscontrol}* & 3.222 & 1.481 & 4.556 & 1.130
      &  1.333 & 2.41209 & 0.04237 & 0.909\\
      \acrshort{relaware}* & 2.111 & 0.928 & 4.889 & 1.054
      &  2.778 & 4.85643 & 0.00126 & 2.512\\
      \acrshort{relcontrol}* & 2.556 & 1.509 & 4.778 & 1.302
      &  2.222 & 3.25515 & 0.01161 & 1.416\\
      \acrshort{surveyscore}* & 19.222 & 6.399 & 27.444 & 5.223
      &  8.222 & 2.93892 & 0.01874 & 1.264\\
      \bottomrule
    \end{tabular}
    \label{tab:survey_summary}
  \end{table}

  \gls{spirit} did not affect orientation awareness or control.
  However, it significantly increased awareness and control for both absolute and relative positioning.
  The aggregate score also significantly increased.

  The largest effect was on the awareness of the position of the drone with respect to the target (\sym{effect}=2.512, \sym{pvalue}=0.00126).
  One strategy that \gls{spirit} users utilized was slewing to the side in order to get a perspective view of the location of the drone with respect to the target.
  By extrapolating the vertical edges of the target, they were able to increase their understanding of the situation.


\hypertarget{decision-tree}{%
\chapter{Decision Tree}\label{decision-tree}}
\section{Introduction}
Decision tree builds classification or regression models in the form of
a tree structure. It breaks down a dataset into smaller and smaller
subsets while at the same time an associated decision tree is
incrementally developed. The final result is a tree with decision nodes
and leaf nodes.

\hypertarget{algorithm}{%
\section{Algorithm}\label{algorithm}}

The core algorithm for building decision trees called ID3 by J. R.
Quinlan which employs a top-down, greedy search through the space of
possible branches with no backtracking. ID3 uses Entropy and Information
Gain to construct a decision tree.

\hypertarget{entropy}{%
\subsection{Entropy}\label{entropy}}

A decision tree is built top-down from a root node and involves
partitioning the data into subsets that contain instances with similar
values (homogeneous). ID3 algorithm uses entropy to calculate the
homogeneity of a sample. If the sample is completely homogeneous the
entropy is zero and if the sample is an equally divided it has entropy
of one.

\hypertarget{information-gain}{%
\subsection{Information Gain}\label{information-gain}}

The information gain is based on the decrease in entropy after a dataset
is split on an attribute. Constructing a decision tree is all about
finding attribute that returns the highest information gain (i.e., the
most homogeneous branches).

\hypertarget{building-a-decision-tree}{%
\section{Building a Decision tree}\label{building-a-decision-tree}}

To build a decision tree, we need to calculate two types of entropy
using frequency tables as follows:

Step 1: Calculate Entropy using the frequency table of target attribute:

\[
\Large E(S) = \sum_{i=1}^{c} -p_i log_2 p_i
\]

Step 2: Calculate Entropy of attributes with respect to target attribute:

\[
\Large E(T, X) = \sum_{c \in X} P(c)E(c)
\] *\emph{\(P(c)\) probability of c}

Step 3: Calculate information gain of attributes and select the highest
node as root node:

\[
\Large Gain(T, X) = E(T) - E(T, X)
\]

Step 4: Generate sub-tables for attributes with respect to parent node
and target node.

Step 5: Repeat untill Entropy reaches 0.

\section{Implementation}
    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{1}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{k+kn}{import} \PY{n+nn}{pandas} \PY{k}{as} \PY{n+nn}{pd}
\PY{k+kn}{from} \PY{n+nn}{sklearn}\PY{n+nn}{.}\PY{n+nn}{tree} \PY{k+kn}{import} \PY{n}{DecisionTreeClassifier}\PY{p}{,} \PY{n}{plot\PYZus{}tree}
\PY{k+kn}{from} \PY{n+nn}{sklearn}\PY{n+nn}{.}\PY{n+nn}{model\PYZus{}selection} \PY{k+kn}{import} \PY{n}{train\PYZus{}test\PYZus{}split}
\PY{k+kn}{from} \PY{n+nn}{sklearn}\PY{n+nn}{.}\PY{n+nn}{preprocessing} \PY{k+kn}{import} \PY{n}{OneHotEncoder}
\PY{k+kn}{from} \PY{n+nn}{sklearn} \PY{k+kn}{import} \PY{n}{metrics}
\PY{k+kn}{import} \PY{n+nn}{matplotlib}\PY{n+nn}{.}\PY{n+nn}{pyplot} \PY{k}{as} \PY{n+nn}{plt}
\end{Verbatim}
\end{tcolorbox}

    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{2}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{n}{dataset} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{read\PYZus{}csv}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{./data/weather.csv}\PY{l+s+s2}{\PYZdq{}}\PY{p}{)}
\PY{n}{map\PYZus{}dict} \PY{o}{=} \PY{p}{\PYZob{}}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Sunny}\PY{l+s+s2}{\PYZdq{}}\PY{p}{:}\PY{l+m+mi}{0}\PY{p}{,} \PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Overcast}\PY{l+s+s2}{\PYZdq{}}\PY{p}{:}\PY{l+m+mi}{1}\PY{p}{,} \PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Rain}\PY{l+s+s2}{\PYZdq{}}\PY{p}{:}\PY{l+m+mi}{3}\PY{p}{,} \PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Hot}\PY{l+s+s2}{\PYZdq{}}\PY{p}{:}\PY{l+m+mi}{0}\PY{p}{,} \PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Mild}\PY{l+s+s2}{\PYZdq{}}\PY{p}{:}\PY{l+m+mi}{1}\PY{p}{,} \PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Cool}\PY{l+s+s2}{\PYZdq{}}\PY{p}{:}\PY{l+m+mi}{2}\PY{p}{,} \PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{High}\PY{l+s+s2}{\PYZdq{}}\PY{p}{:}\PY{l+m+mi}{0}\PY{p}{,} \PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Normal}\PY{l+s+s2}{\PYZdq{}}\PY{p}{:}\PY{l+m+mi}{1}\PY{p}{,} \PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Weak}\PY{l+s+s2}{\PYZdq{}}\PY{p}{:}\PY{l+m+mi}{0}\PY{p}{,} \PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Strong}\PY{l+s+s2}{\PYZdq{}}\PY{p}{:}\PY{l+m+mi}{1}\PY{p}{,} \PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Yes}\PY{l+s+s2}{\PYZdq{}}\PY{p}{:}\PY{l+m+mi}{1}\PY{p}{,} \PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{No}\PY{l+s+s2}{\PYZdq{}}\PY{p}{:}\PY{l+m+mi}{0}\PY{p}{\PYZcb{}}
\PY{n}{dataset}\PY{o}{.}\PY{n}{head}\PY{p}{(}\PY{p}{)}
\end{Verbatim}
\end{tcolorbox}

            \begin{tcolorbox}[breakable, size=fbox, boxrule=.5pt, pad at break*=1mm, opacityfill=0]
\prompt{Out}{outcolor}{2}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
    Outlook  Temp Humidity    Wind PlayTennis
0     Sunny   Hot     High    Weak         No
1     Sunny   Hot     High  Strong         No
2  Overcast   Hot     High    Weak        Yes
3      Rain  Mild     High    Weak        Yes
4      Rain  Cool   Normal    Weak        Yes
\end{Verbatim}
\end{tcolorbox}

    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{3}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{n}{X\PYZus{}raw} \PY{o}{=} \PY{n}{dataset}\PY{o}{.}\PY{n}{iloc}\PY{p}{[}\PY{p}{:}\PY{p}{,}\PY{l+m+mi}{0}\PY{p}{:}\PY{o}{\PYZhy{}}\PY{l+m+mi}{1}\PY{p}{]}
\PY{n}{y} \PY{o}{=} \PY{n}{dataset}\PY{o}{.}\PY{n}{iloc}\PY{p}{[}\PY{p}{:}\PY{p}{,}\PY{o}{\PYZhy{}}\PY{l+m+mi}{1}\PY{p}{]}
\end{Verbatim}
\end{tcolorbox}

    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{4}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{n}{X} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{p}{(}\PY{p}{)}
\PY{k}{for} \PY{n}{x} \PY{o+ow}{in} \PY{n}{X\PYZus{}raw}\PY{p}{:}
    \PY{n}{X}\PY{p}{[}\PY{n}{x}\PY{p}{]} \PY{o}{=} \PY{n}{X\PYZus{}raw}\PY{p}{[}\PY{n}{x}\PY{p}{]}\PY{o}{.}\PY{n}{map}\PY{p}{(}\PY{n}{map\PYZus{}dict}\PY{p}{)}
\PY{n}{X\PYZus{}train}\PY{p}{,} \PY{n}{X\PYZus{}test}\PY{p}{,} \PY{n}{y\PYZus{}train}\PY{p}{,} \PY{n}{y\PYZus{}test} \PY{o}{=} \PY{n}{train\PYZus{}test\PYZus{}split}\PY{p}{(}\PY{n}{X}\PY{p}{,} \PY{n}{y}\PY{p}{,} \PY{n}{test\PYZus{}size}\PY{o}{=}\PY{o}{.}\PY{l+m+mi}{25}\PY{p}{,} \PY{n}{random\PYZus{}state}\PY{o}{=}\PY{l+m+mi}{42}\PY{p}{)}
\PY{n}{X}
\end{Verbatim}
\end{tcolorbox}

            \begin{tcolorbox}[breakable, size=fbox, boxrule=.5pt, pad at break*=1mm, opacityfill=0]
\prompt{Out}{outcolor}{4}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
    Outlook  Temp  Humidity  Wind
0         0     0         0     0
1         0     0         0     1
2         1     0         0     0
3         3     1         0     0
4         3     2         1     0
5         3     2         1     1
6         1     2         1     1
7         0     1         0     0
8         0     2         1     0
9         3     1         1     0
10        0     1         1     1
11        1     1         0     1
12        1     0         1     0
13        3     1         0     1
\end{Verbatim}
\end{tcolorbox}

    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{5}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{n}{model} \PY{o}{=} \PY{n}{DecisionTreeClassifier}\PY{p}{(}\PY{n}{criterion}\PY{o}{=}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{entropy}\PY{l+s+s2}{\PYZdq{}}\PY{p}{)}
\PY{c+c1}{\PYZsh{} Train Decision Tree Classifier}
\PY{n}{model} \PY{o}{=} \PY{n}{model}\PY{o}{.}\PY{n}{fit}\PY{p}{(}\PY{n}{X\PYZus{}train}\PY{p}{,}\PY{n}{y\PYZus{}train}\PY{p}{)}
\PY{c+c1}{\PYZsh{}Predict the response for test dataset}
\PY{n}{y\PYZus{}pred} \PY{o}{=} \PY{n}{model}\PY{o}{.}\PY{n}{predict}\PY{p}{(}\PY{n}{X\PYZus{}test}\PY{p}{)}
\end{Verbatim}
\end{tcolorbox}

    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{6}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{n+nb}{print}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Accuracy:}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{metrics}\PY{o}{.}\PY{n}{accuracy\PYZus{}score}\PY{p}{(}\PY{n}{y\PYZus{}test}\PY{p}{,} \PY{n}{y\PYZus{}pred}\PY{p}{)}\PY{p}{)}
\end{Verbatim}
\end{tcolorbox}

    \begin{Verbatim}[commandchars=\\\{\}]
Accuracy: 0.75
    \end{Verbatim}

    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{7}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{n}{plt}\PY{o}{.}\PY{n}{figure}\PY{p}{(}\PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{150}\PY{p}{)}
\PY{n}{plot\PYZus{}tree}\PY{p}{(}\PY{n}{model}\PY{p}{,} \PY{n}{feature\PYZus{}names}\PY{o}{=}\PY{n}{X\PYZus{}raw}\PY{o}{.}\PY{n}{columns}\PY{p}{,} \PY{n}{filled}\PY{o}{=}\PY{k+kc}{True}\PY{p}{)}
\end{Verbatim}
\end{tcolorbox}

            \begin{tcolorbox}[breakable, size=fbox, boxrule=.5pt, pad at break*=1mm, opacityfill=0]
\prompt{Out}{outcolor}{7}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
[Text(348.75, 396.375, 'Wind <= 0.5\textbackslash{}nentropy = 0.971\textbackslash{}nsamples = 10\textbackslash{}nvalue = [4,
6]'),
 Text(209.25, 283.125, 'Outlook <= 0.5\textbackslash{}nentropy = 0.722\textbackslash{}nsamples = 5\textbackslash{}nvalue =
[1, 4]'),
 Text(139.5, 169.875, 'Temp <= 1.5\textbackslash{}nentropy = 1.0\textbackslash{}nsamples = 2\textbackslash{}nvalue = [1,
1]'),
 Text(69.75, 56.625, 'entropy = 0.0\textbackslash{}nsamples = 1\textbackslash{}nvalue = [1, 0]'),
 Text(209.25, 56.625, 'entropy = 0.0\textbackslash{}nsamples = 1\textbackslash{}nvalue = [0, 1]'),
 Text(279.0, 169.875, 'entropy = 0.0\textbackslash{}nsamples = 3\textbackslash{}nvalue = [0, 3]'),
 Text(488.25, 283.125, 'Humidity <= 0.5\textbackslash{}nentropy = 0.971\textbackslash{}nsamples = 5\textbackslash{}nvalue =
[3, 2]'),
 Text(418.5, 169.875, 'entropy = 0.0\textbackslash{}nsamples = 2\textbackslash{}nvalue = [2, 0]'),
 Text(558.0, 169.875, 'Outlook <= 2.0\textbackslash{}nentropy = 0.918\textbackslash{}nsamples = 3\textbackslash{}nvalue = [1,
2]'),
 Text(488.25, 56.625, 'entropy = 0.0\textbackslash{}nsamples = 2\textbackslash{}nvalue = [0, 2]'),
 Text(627.75, 56.625, 'entropy = 0.0\textbackslash{}nsamples = 1\textbackslash{}nvalue = [1, 0]')]
\end{Verbatim}
\end{tcolorbox}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{./figures/DT1.png}
    \end{center}
    { \hspace*{\fill} \\}

    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{8}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{k}{def} \PY{n+nf}{make\PYZus{}prediction}\PY{p}{(}\PY{n}{case}\PY{p}{)}\PY{p}{:}
    \PY{n}{df} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{p}{(}\PY{n}{case}\PY{p}{)}\PY{p}{[}\PY{l+m+mi}{0}\PY{p}{]}\PY{o}{.}\PY{n}{map}\PY{p}{(}\PY{n}{map\PYZus{}dict}\PY{p}{)}
    \PY{k}{return} \PY{n}{model}\PY{o}{.}\PY{n}{predict}\PY{p}{(}\PY{p}{[}\PY{n}{df}\PY{p}{]}\PY{p}{)}
\end{Verbatim}
\end{tcolorbox}

    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{9}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{n+nb}{print}\PY{p}{(}\PY{n}{make\PYZus{}prediction}\PY{p}{(}\PY{p}{[}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Overcast}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Hot}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{High}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Strong}\PY{l+s+s2}{\PYZdq{}}\PY{p}{]}\PY{p}{)}\PY{p}{)}
\end{Verbatim}
\end{tcolorbox}

    \begin{Verbatim}[commandchars=\\\{\}]
['No']
    \end{Verbatim}

    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{10}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{n+nb}{print}\PY{p}{(}\PY{n}{make\PYZus{}prediction}\PY{p}{(}\PY{p}{[}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Overcast}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Hot}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Normal}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Weak}\PY{l+s+s2}{\PYZdq{}}\PY{p}{]}\PY{p}{)}\PY{p}{)}
\end{Verbatim}
\end{tcolorbox}

    \begin{Verbatim}[commandchars=\\\{\}]
['Yes']
    \end{Verbatim}

    % Add a bibliography block to the postdoc

MCA/Machine Learning/Project file/Tex source/Decision Tree.tex