\newcommand{\Val}{\fun{Val}}
\newcommand{\POV}[2]{\ensuremath{\mathsf{PresOfVal}(#1, \mathsf{#2})}}

\section{Properties}
\label{sec:properties}

The properties of this section are modifications and additions to the properties of the Shelley ledger. See \cite{shelley_spec} for definitions used here. We need to amend the definition of $\Val$ to the following:

\begin{equation*}
    \Val(x \in \Value) = x
\end{equation*}
\begin{equation*}
    \Val(x \in \Coin) = \fun{inject}~x
\end{equation*}
\begin{equation*}
    \Val((\wcard\mapsto (y \in \Value))^{*}) = \sum y
\end{equation*}

\begin{lemma}
  \label{lemma:utxo-pres-of-value}
  For all environments $e$, transactions $t$, and states $s$, $s'$, if
  \begin{equation*}
    e\vdash s\trans{utxo}{t}s'
  \end{equation*}
  then
  \begin{equation*}
    \Val(s) + wm = \Val(s')
  \end{equation*}
  where $wm = \fun{inject} (\fun{wbalance}~(\fun{txwdrls}~{t})) + \fun{mint}~(\fun{txbody}~{t})$.
\end{lemma}
\begin{proof}
  The proof is identical to the corresponding one in the previous
  specification, except that unfolding $\fun{consumed}$ gives an
  additional $\fun{mint}~{txb}$ term and all $\Coin$ quantities have
  to be converted to $\Value$.
\end{proof}

We also need to track the sum of the $\fun{mint}$ fields of all
transactions in a block, for which we write $\fun{mint}(b)$.

\begin{theorem}[Preservation of Value]
  \label{thm:chain-pres-of-value}
  For all environments $e$, blocks $b$, and states $s$, $s'$, if
  \begin{equation*}
    e\vdash s\trans{chain}{b}s'
  \end{equation*}
  then
  \begin{equation*}
    \Val(s) + \fun{mint}(b) = \Val(s')
  \end{equation*}
\end{theorem}
\begin{proof}
  Similar to the corresponding proof in the Shelley specification,
  for a given $x$ and transition $\mathsf{TR}$, let \POV{x, TR}
  be the statement:

  \begin{tabular}{l}
    for all environments $e$, signals $\sigma$, and states $s$, $s'$,
    $$
    $e\vdash s\trans{tr}{\sigma}s'~\implies~\Val(s) + x = \Val(s')$.
    $$
  \end{tabular}
  \noindent
  Then, \POV{\fun{mint}~{txb}}{LEDGER} follows from
  Lemma~\ref{lemma:utxo-pres-of-value}.  By induction, we have \\
  \POV{\fun{mint}(b)}{LEDGERS}. The rest of the proof works as
  previously, using \POV{0}{TR} or \POV{\fun{mint}(b)}{TR} as needed.
\end{proof}

\begin{theorem}[Preservation of Ada]
  \label{thm:chain-pres-of-ada}
  For all environments $e$, blocks $b$, and states $s$, $s'$, if
  \begin{equation*}
    e\vdash s\trans{chain}{b}s'
  \end{equation*}
  then
  \begin{equation*}
    \fun{coin}(\Val(s)) = \fun{coin}(\Val(s'))
  \end{equation*}
\end{theorem}
\begin{proof}
  The hypothesis implies that for all transactions $tx$ included in
  $b$, there exist some $e_{tx}, s_{tx}$ and $s'_{tx}$ such that
  $e_{tx}\vdash s_{tx}\trans{utxo}{tx}s'_{tx}$, so
  $\fun{coin}(\fun{mint}~tx) = 0$ for all transactions included
  in $b$. This implies $\fun{coin}(\fun{mint}(b)) = 0$, so the
  claim follows by Lemma~\ref{thm:chain-pres-of-value}.
\end{proof}


 %++++++++++++++++++++++++++++++++++++++++
\documentclass[letterpaper,12pt]{article}
\usepackage{tabularx}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage[margin=1in,letterpaper]{geometry}
\usepackage{cite}
\usepackage[final]{hyperref}
\hypersetup{
    colorlinks=true,
    linkcolor=blue,
    citecolor=blue,
    filecolor=magenta,
    urlcolor=blue
}
%++++++++++++++++++++++++++++++++++++++++

\begin{document}

\title{A Brief Exploration of the NBA Draft}
\author{Mike "dirty-mike" Neuder}
\date{\today}
\maketitle

\begin{abstract}
This quick analysis of the NBA draft was inspired and written for Phil Derbesy and Michael Chiappini of the exceptional podcast, "The Basketball Guyaries". During Episode 4, they are exploring the complexity of the current NBA draft, and ask for a bit of clarification on the probabilities going on to determine the order of picks. With the 2017 Draft just occurring, it seemed appropriate to take a glance at the process and learn more about how 14 ping-pong balls can change everything.
\end{abstract}

\section{Current Lottery System}
The current weighted lottery system was implemented in 1990 and reformed in 1993. The system was changed due to teams allegedly losing games intentionally during the near the end of the season in order to secure the first pick in the draft, as the team with the worst record of the season got the first pick. In the new weighted lottery system, the teams with the worst records still have the highest chance to pick early in the draft, however there is an element of randomness introduced in order to make it less appealing to be the worst team in the NBA. Currently, with 30 teams in the NBA, 16 will qualify for the playoffs and the remaining 14 are eligible to participate in the lottery. Since 1987, only the first three picks are determined by the lottery, and the remaining picks are done in reverse record order. Under this current system, the worst team of the previous season at least would be picking fourth in the draft, while the second worst team would choose at latest fifth and so forth. Now that the stage is set, lets look at how it works.

\section{A Bit of Math}
The first three picks are determined by a random selection of ping-pong balls numbered one through fourteen.  These balls are put into a lottery machine, and four are selected at random. Because order doesn't matter, (i.e. $5,6,7,8 = 5,7,6,8 = 5,8,7,6 = etc$), the total number of combinations is 1001. We can calculate by recalling our Algebra 2 formula for combinations, where $n$ is the total number of items, and $r$ is how many we want to select while ignoring order.
$$ \binom{n}{r} = \frac{n!}{r!\cdot(n-r)!}$$ \newpage
In this context, we say we have 14 choose 4 combinations of ping-pong balls and by using our handy formula we can conclude that the number of combinations is,
$$\binom{14}{4} = \frac{14!}{4!\cdot(14-4)!} = \frac{87178291200}{24 \cdot 3628800} = 1001.$$
Out of all these combinations, only one isn't assigned to a team ($11,12,13,14$). The remaining 1000 combinations are distributed among the 14 non-playoff teams based on their regular season record according to the table below. Note that the rank column is in reverse order (worst team is ranked 1 and so forth).

\begin{center}
\begin{tabular}{ |c|c|c| }
 \hline
 rank & number of combinations & probability of being drawn \\
 \hline
 1 & 250 & 0.2498 \\
 2 & 199 & 0.1988 \\
 3 & 156 & 0.1558 \\
 4 & 119 & 0.1189 \\
 5 & 88 & 0.0879 \\
 6 & 63 & 0.0629 \\
 7 & 43 & 0.0429 \\
 8 & 28 & 0.0280 \\
 9 & 17 & 0.0170 \\
 10 & 11 & 0.0110 \\
 11 & 8 & 0.0080 \\
 12 & 7 & 0.0070 \\
 13 & 6 & 0.0060 \\
 14 & 5 & 0.0050 \\
 \hline
\end{tabular}
\end{center}

It is clear that as the better teams in the lottery have a pretty slim chance at landing a top pick. Another interesting thing to note is that if the 14th worst team in the league doesn't get one of the first three picks, they are locked into receiving the 14th pick, due to the fact that after the first three picks the selections are given in reverse record order. One last thing to examine is the probabilities of each team earning a specific pick. Note that in the table below, a cell with a '-' implies that this team cannot receive this pick.
\begin{center}
\includegraphics[scale=0.6]{../images/table.png}
\end{center} \newpage

In order to better visualize these probabilities I created a couple plots displayed below. The first plot shows a given teams probability of receiving any of the first fourteen draft slots.
\begin{center}
\includegraphics[scale=0.5]{../images/plot1.png}
\end{center}

I found it interesting that as you move farther into the draft the teams are have more certainty around which pick they will be receiving. The next plot I created is quite similar, but instead of plotting the probability of a team receiving a pick, it displays the probability that a team will have picked by the $n^{th}$ slot of the draft. For example, team 1 will have .250 chance of having picked after round 1, and after round two they will have $.250 + .215 = .465$ chance of having picked.

\begin{center}
\includegraphics[scale=0.5]{../images/plot2.png}
\end{center} \newpage

As expected, one team per round will reach a probability having picked of 1. This is due to the fact that the worst slot the rank 1 team can be assigned is fourth, and the result follows for the remaining teams.

\section{Conclusions}
In a sport dominated by superstars, securing strong draft picks is hugely important for NBA teams. Though the process is complicated and long, it is nice to know that in a world where control is paramount, a little bit of randomness can turn expectation on its head. Thanks for reading.\begin{footnote}{ if you are interested in seeing how i collected and plotted the data or want to play around with any of the files they are being hosted \href{https://github.com/michaelneuder/nba_draft}{here}. if you find any errors or have any questions feel free to get in touch.}\end{footnote} \\ \\
-dirty mike

\newpage
\begin{thebibliography}{99}

\bibitem{melissinos}
\url{https://en.wikipedia.org/wiki/NBA_draft_lottery}

\bibitem{Cyr}
\url{http://www.nba.com/news/draft/nba-draft-lottery-what-will-happen-2016/}

\bibitem{Wiki}
\url{https://www.sbnation.com/nba/2017/4/13/15268144/nba-draft-lottery-odds-2017-lakers-celtics-suns}

\end{thebibliography}

\end{document}


%\section{Physical Human Factors Report: Tristan Griffith}
\rhead{\today}
\begin{center}
{\large  Tristan Griffith}\\
\vspace{2mm}
{\large Dr. James Hubbard Jr.}
\noindent\rule{\textwidth}{2pt}
\end{center}
\setcounter{section}{1}

%\begin{wrapfigure}{r}{0.45\textwidth}
%\centering
%\includegraphics[scale=.3]{../../../figures/demo_map.png}
%\caption{Modal Heatmap for Subject 32}
%\end{wrapfigure}
\subsection{Motivation}
In the past months, we have become very comfortable converting EEG signals into state space models using output only system identification techniques. As it stands, these models are somewhat useful for biometric classification and analysis, but have not been extended to the quantum domain, which is a desired outcome of our research. The principle barrier preventing the application of quantum probability to these models is the restrictive formulation of the quantum Hilbert space itself, which among other things, requires the state matrix to take the form $-iH$, where $H$ is a self-adjoint matrix. The self-adjoint structure is especially important in quantum probability, because it preserves the norm of the initial condition $\big(||x_0||=||x(t)||\big)$ as the system evolves, ensuring the state vector is still a probability distribution over the possible collapse states.

Physical systems of the form $\dot{x}=Ax+Bu $ rarely have this much structure in their state matrices, so modern system identification techniques do not provide means to directly estimate a self-adjoint matrix from a set of black box measurements. An additional technique is required to convert models generated from these system identification techniques to quantum models robustly, with minimal loss of information. We previously found that generating the self-adjoint matrix as $A_h=\frac{1}{2}(A \pm A^T)$  was removing as much as half the information in the original matrix $A$ as measured by the induced metric.
\subsection{Problem Statement}
Modern system identification techniques do not allow for the discovery of quantum-like models as the eigenvalues identified from the black box system are not restricted to quantum eigenvalues. Therefore, additional methods are needed to convert these existing system identification state space models into quantum state space models with the accompanying mathematical structure.
\subsection{The Hadamard Transform Applied to EEG Modes}
\subsubsection{Transform Basics}
\label{sec:basics}
The Hadamard transform is the most common method for decomposing signals into a set of orthogonal functions that are not trigonometric which are a specific form of Walsh function. The Hadamard transform is analogous to the Fourier transform, but uses orthogonal square waves instead of sines and cosines. A comparison of the first eight Fourier functions and first eight Hadamard functions is in Figure \ref{fig:hf_comp}.
\begin{figure}[]
    \centering
    \includegraphics[scale=0.5]{../../../figures/func_comp.png}
    \caption{Fourier vs. Hadamard Base Functions}
    \label{fig:hf_comp}
\end{figure}
The Hadmard transform has been popular in algorithmic applications, because the nature of square waveforms can be described by a recursive relationship that is easily carried out by computers. The Hadamard transform requires less computational complexity to decompose a given signal into its Walsh functions. The Hadamard transform may be computed with the following recursive function:
\begin{align}
H_1 &\equiv \frac{1}{\sqrt{2}}\begin{bmatrix}
1 & 1\\ 1 & -1
\end{bmatrix} \label{eqn:hada1} \\
H_n=H_1 \otimes H_{n-1}=&\frac{1}{\sqrt{2}}\begin{bmatrix}
H_{n-1} & H_{n-1}\\ H_{n-1} & -H_{n-1}
\end{bmatrix}
\end{align}
Intuitively, equation \ref{eqn:hada1} represents the first two functions in the Walsh function set for the Hadamard transform. The first is a straight line with value one. It has no transition across the origin from 1 to -1, so it does not have any sign changes in its column. The second column corresponds to a function with a single transition from 1 to -1, represented by a single sign change in the column. Higher and higher order Hadamard transforms can be easily determined. The Hadamard matrix corresponding to Figure \ref{fig:hf_comp} is:
\begin{align}
H_8=\left(\begin{array}{cccccccc} 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1\\ 1 & -1 & 1 & -1 & 1 & -1 & 1 & -1\\ 1 & 1 & -1 & -1 & 1 & 1 & -1 & -1\\ 1 & -1 & -1 & 1 & 1 & -1 & -1 & 1\\ 1 & 1 & 1 & 1 & -1 & -1 & -1 & -1\\ 1 & -1 & 1 & -1 & -1 & 1 & -1 & 1\\ 1 & 1 & -1 & -1 & -1 & -1 & 1 & 1\\ 1 & -1 & -1 & 1 & -1 & 1 & 1 & -1 \end{array}\right) \label{eqn:h8}
\end{align}
Notice that the ordering of the columns in equation \ref{eqn:h8} is not ordered from least to most transitions, but that the constant 1 function is immediately followed by the square wave with the maximum number of transitions. These columns may be reordered for convenience or interpretation. Ordering in terms of number of transitions is known as sequency ordering, as in Figure \ref{fig:hf_comp}, and is most commonly found in signal processing applications.  Hadamard ordering, which is used in controls applications, arranges them as 0, 4, 6, 2, 3, 7, 5, 1. Dyadic or gray code ordering, which is used in mathematics, arranges them as 0, 1, 3, 2, 6, 7, 5, 4.
\begin{figure}[]
    \centering
    \includegraphics[scale=0.5]{../../../figures/wht_waveform_1.png}
    \caption{Hadamard vs. Sequency Ordering}
    \label{fig:ordering}
\end{figure}
Keeping track of which ordering method an algorithm uses is critical. The Discrete Walsh Hadamard Transform (DWHT) had been widely used for biometric identification, data compression, and image segmentation. Figure \ref{fig:comp} demonstrates how the DWHT, along with the Discrete Cosine Transform (DCT), are better suited to image compression that traditional methods centered on the Discrete Fourier Transform (DFT) \cite{bull2014communicating}.
\begin{figure}[]
    \centering
    \includegraphics[scale=0.7]{../../../figures/hada_example.jpg}
    \caption{Comparison of Decomposition Methods}
    \label{fig:comp}
\end{figure}
Notice that the DWHT and DCT concentrate their high energy areas in a single corner, unlike the DFT. This makes it much easier to set a cutoff point for image compression.
\subsubsection{Hadamard Logic Gates}
Nothing in the previous section indicates that the Hadamard transform is better suited to application on quantum cognitive models than any other decomposition method. The Hadamard transform piqued our interest due to its relevance in both signal processing and quantum logic gate operations. Hadamard Gates are often used as the first step in a proposed quantum algorithm. They have the neat property of smearing the initial condition into a superposition of all possible states evenly in a given quantum probability space.

For example, if we are working in a two dimensional space, such as that of qubits, we may have an initial state:
\begin{align}
x_0=\begin{bmatrix}
1 \\ 0
\end{bmatrix}
\end{align}
If we pass this initial state through a Hadamard Gate, it becomes:
\begin{align}
H x_0=x_0'\\
\frac{1}{\sqrt{2}}\begin{bmatrix}
1 & 1\\1 & -1
\end{bmatrix}\begin{bmatrix}
1 \\ 0
\end{bmatrix}=\frac{1}{\sqrt{2}}\begin{bmatrix}
1 \\ 1
\end{bmatrix}
\end{align}
Before passing the initial condition through the Hadamard gate, the system was in a prepared state. After passing through the gate, the probability distribution is evenly distributed over both possible measurement outcomes. Notice that it is very important to carry the normalizing term along with the Hadamard matrix so that it is a unitary transform. This is true for systems of higher order, of course:
\begin{align}
x_0=\begin{bmatrix}
0 \\ 1 \\ 0 \\0
\end{bmatrix}\\
x_0'=\frac{1}{2}\left(\begin{array}{cccc} 1 & 1 & 1 & 1\\ 1 & -1 & 1 & -1\\ 1 & 1 & -1 & -1\\ 1 & -1 & -1 & 1 \end{array}\right)\begin{bmatrix}
0 \\ 1 \\ 0 \\0
\end{bmatrix}=\frac{1}{2}\begin{bmatrix}
1 \\ -1 \\1\\-1
\end{bmatrix}
\end{align}
And so on and so on. For algorithms where we expect a certain outcome regardless of initial conditions, this is a quick method to remove potential bias in the preparation of the quantum state. Notice further that this process is reversible, and we can recover $x_0$ from $x_0'$.
\subsubsection{``Quantumness'' of OMA and Hadamard Modes}
So we've established an intuitive connection to the Hadamard transform. It's useful in signal processing and in quantum probability, so it may get us closer to a probabilistic model of cognition. We may look at the resultant state space model from our operational modal analysis on EEG data $A_{OMA}$. $A_{OMA}$ has complex eigevalues and eigenvectors. Further, the eigenvectors are not orthogonal. Quantum state Hamiltonian matricies are known to have only real valued eigenvalues with corresponding orthogonal eigenvectors which represent the basic observables in the quantum model. We may Hadamard transform $A_{OMA}$:
\begin{align}
A_{h}=HA_{OMA}
\end{align}
The resultant matrix has real valued eigenvalues, which gets us a little closer to a quantum Hamiltonian. Regardless of the ordering, however, the eigenvectors of $A_h$ are not orthogonal unless the original eigenvalues of $A_{OMA}$ were orthogonal to begin with.

A computational example illustrates this point. The identify matrix has orthogonal eigenvectors beforehand:
\begin{align}
\phi_0(I)=\begin{bmatrix}
1 \\0
\end{bmatrix},\begin{bmatrix}
0 \\ 1
\end{bmatrix}\\
I_{h}=HI\\
I_{h}=\frac{1}{\sqrt{2}}\begin{bmatrix}
1 & 1\\1 & -1
\end{bmatrix}\begin{bmatrix}
1 & 0\\0 & 1
\end{bmatrix}\\
\lambda_{I_h}=\pm 1\\
\phi=\begin{bmatrix}
1 \pm \sqrt{2} \\ 1
\end{bmatrix}
\end{align}
While $I_h$ has different eigenvectors than $I$, they remain orthogonal. Conversely, if we consider an example 2x2 matrix from our OMA analysis:
\begin{align}
A_{OMA}=\left(\begin{array}{cc} 0.728 & 0.345\\ -0.378 & 0.923 \end{array}\right)\\
\phi_0(A_{OMA})=\left(\begin{array}{cc} 0.186-0.665{}\mathrm{i} & 0.186+0.665{}\mathrm{i}\\ 0.723 & 0.723 \end{array}\right) \label{eqn:phiA}
\end{align}
From equation \ref{eqn:phiA}, it can be seen that the eigenvectors are not orthogonal.
\begin{align}
A_{h}=HA_{OMA}\\
A_{h}=\frac{1}{\sqrt{2}}\begin{bmatrix}
1 & 1\\1 & -1
\end{bmatrix}A_{OMA}\approx \left(\begin{array}{cc} 0.248 & 0.896\\ 0.782 & -0.409 \end{array}\right)\\
\lambda_{A_h}=0.819,-0.980\\
\phi(A_h)=\left(\begin{array}{cc} 0.843 & -0.59\\ 0.537 & 0.808 \end{array}\right)
\end{align}
A few things to note here:
\begin{itemize}
\item Neither $A_{OMA}$, or $A_h$ have orthogonal eigenvectors
\item $A_h$ has eigenvalues in the right half plane (unstable poles)
\item Unlike $A_{OMA}$, notice that $A_h\approx A_h^*$
\end{itemize}
Therefore, we have to conclude that the Hadamard transform doesn't get us all the way to a quantum Hamiltonian. However, I notice that it provides wholly real eigenvalues, which is a step closer to quantum. Further, the state matrix is almost self-adjoint, and looks to me like some of the noisy state matrices I used to develop the earlier \href{https://drive.google.com/file/d/17kZl22Yy5hwzDv9F1psR9IAmViYwAzik/view?usp=sharing}{least squares SINDy like Hamiltonian estimator}. Perhaps we can go one more step, using the SINDy algorithm to get to a quantum Hamiltonian.
\subsubsection{Least Squares to Nearest Hamiltonian}
So far, we've shown that the Hadamard transform, while getting us closer to a quantum Hamiltonian, does not totally complete the path from EEG signals to quantum probability space.

\textcolor{red}{Ok. So this was a nice idea. I could be further developed. However, as I'm looking at the linear systems side of things, we have issues.} Primarily, with the transform taking the form $A_{h}=HA_{OMA}$, the transform is operating on the state matrix, not on the vector. Normally a transform is defined as:
\begin{align}
\bar{x}=Tx\\
\bar{\dot{x}}=T\dot{x}\\
\dot{x}=Ax\\
T^{-1}\bar{\dot{x}}=AT^{-1}\bar{x}\\
\bar{\dot{x}}=TAT^{-1}\bar{x}\\
\end{align}
However, I did something different:
\begin{align}
\bar{x}=HA\dot{x}
\end{align}
Since the operation was applied on the state matrix and not on the state vector, the thing you are differentiating in $\dot{x}$ and the result of $\bar{x}$ aren't the same. After consulting with Dr. Balas (2020-11-05), I'm not aware of other transforms like that, and I've destroyed the meaning or use of the state transition matrix $\Phi$. Even though $\bar{x}$ is in a quantum space, $\dot{x}$ is still in the measure space. I may abandon this for the time being and take a look at some other methods. Argh so close.
\subsubsection{Reachability?}
I would have shown that the use of the least squares estimator averages the distance between the off diagonal components, and that introduces an interval for reachability.
\subsection{Results}
\subsubsection{A Quantum Hamiltonian}
\subsubsection{Interpretation of Model}

\subsection{Discussion}

%\begin{displayquote}
%The class of monotone DNF expressions is learnable via an algorithm $B$ that uses $L=L(h,d)$ calls of examples and $dt$ calls of oracle, where $d$ is the degree of the DNF expression $f$ to be learnt and $t$ the number of variables.
%\end{displayquote}

%\begin{wrapfigure}{r}{0.55\textwidth}
%\centering
%\includegraphics[scale=.5]{../figures/complexity.png}
%\caption{The Error-Complexity Trade Off}
%\end{wrapfigure}


\documentclass[11pt]{article}
\usepackage{setspace}
\usepackage{pxfonts}
\usepackage{graphicx}
\usepackage{geometry}

\geometry{letterpaper,left=.5in,right=.5in,top=0in,bottom=.75in,headsep=5pt,footskip=20pt}

\title{Problem Set 3 -- Integrate-and-fire neuron model}
\author{Computational Neuroscience Summer Program}
\date{June, 2011}

\begin{document}
\maketitle

In this problem set you will be building a simple integrate-and-fire
neuron.  You should assume a specific membrane capacitance of
$c_m = 10$ nF/mm\textsuperscript{2}, a specific membrane resistance of
$r_m = 1$ M$\Omega\cdot$mm\textsuperscript{2}, a resting membrane
potential of $E = -70$ mV, a reset potential of $V_{reset} = -80$ mV,
an action potential threshold of $V_{threshold} = -55$ mV, and a cell
surface area of $A = 0.025$ mm\textsuperscript{2}.  Write up your results in
a text editor of your choosing.  Include any relevant figures, your
Matlab code, and any other calculations related to the problem set.  You may work individually or in groups, but each student should hand in their own report.

\subsection*{Equations}

\begin{center}
\begin{tabular}{ll}
$C_m = A \cdot c_m$ & $R_m = \frac{r_m}{A}$\tabularnewline
$\tau_m = c_m \cdot r_m$ & $V_\infty = E + R_mI_{ext}$\tabularnewline
$V(t) = V_\infty + (V(0) - V_\infty)e^\frac{-t}{\tau_m}$ & $r_{isi} =
(\tau_m \mathrm{ln}(\frac{R_mI_{ext} + E - V_{reset}}{R_mI_{ext} + E -
  V_{threshold}}))^{-1}$\tabularnewline
$\tau_m\frac{dV}{dt} = E - V(t-1) + R_mI_{ext}$ & \tabularnewline
\end{tabular}
\end{center}

\subsection*{Problems}

\paragraph{1.} Model an integrate-and-fire neuron using the equations
above and the following rule: when the neuron's membrane voltage exceeds
$V_{threshold}$, set the voltage in that timestep to $V_{peak} = 40$ mV, and in the
next timestep set the voltage to $V_{reset}$.  Set $dt = 0.1$ ms.  Apply a square pulse of
0.5 nA from $t = 250$ ms until $t = 750$ ms in your simulation.  Use
Matlab's subplot command to plot the membrane voltage over time in the
top panel and $I_{ext}$ in the bottom panel (use the same time scale
for the horizontal axis of both plots).  No text is required for this
question; just include a plot.

\paragraph{2.} Compute the average firing rate (spikes per second) of the integrate-and-fire neuron
for the pulse interval you used in quesion 1 (500 ms).  Now plot simulated firing rate vs $r_{isi}$ for several values of $I_{ext}$ (use $I_{ext}$ between 0 and 1 nA).  How does the firing rate of the modeled neuron compare to the estimated firing
rate given by $r_{isi}$?  Note: the equation for $r_{isi}$ only holds if $V_\infty > V_{thresh}$; otherwise, $r_{isi} = 0$.

\paragraph{3.}  Starting from 0 nA, gradually increase the amount of external current
injected into the integrate-and-fire neuron in steps of 0.01 nA.  Keep the pulse duration constant at 500 ms.  What is the smallest amount of current you
can inject which will still result in an action potential?  Is there a
maximum firing rate this neuron can achieve?  Why or why not?

\paragraph{4.  Challenge problem.} Compute firing rate as a function of pulse duration, $I_{duration}$, using 20 durations between 10 and 500 ms.  Repeat this for several different values of $I_{ext}$ (try using 10 log-spaced values between 0.1 and 5 nA).  Explain what you see.  In particular, are the firing rate curves smooth or jagged?  Why?

\paragraph{5.} Vary the resting potential, specific
capacitance, specific resistance, and surface area variables.  How do
increases or decreases in these values affect firing rate of the integrate-and-fire neuron?  Explain
(try to stay at or under 1-2 sentences per variable).  Include plots for each of these variables.

\end{document}


\section{Introduction}

\begin{fullwidth}

Pursuing abstractness and generality, a number of books and articles in
econometrics rely heavily on standard algebraic proofs.
However, most of the theorems proved in such a way have a strong geometric appeal.
This paper demonstrates how shorter, less technical and even more beautiful the proofs
can be when they are based on geometric theorems.
We show that this technique can be extended to explain
concepts in probability and statistics.

Although most of the theorems and ideas are not completely new and
there are even a few works on the geometry in econometrics and statistics,
this paper introduces alternative explanations and more general results in some cases.
Further, there are algebraic proofs provided parallel to geometric ones
and illustrations which are our own work.
The illustrations are published at \url{https://github.com/olyagnilova/gauss-markov-pythagoras} and licensed under the
Creative Commons Attribution 4.0. % todo: wiki
They are free to use and have the potential to serve as a pedagogical tool
in explaining material for students.

Other researchers have done similar work, an especially
thought-provoking and motivating paper was
\citeauthor{cobb2011teaching}.
The geometric proof of the Gauss-Markov theorem and the introduction of the Herschel-Maxwell approach are inspired by
\citeauthor{cobb2011teaching}'s work.
\citeauthor{jacobson}'s (\citeyear{jacobson}) thesis \citetitle{jacobson}
is a comprehensive overview of a geometric approach in linear models including
statistical foundations.
\citeauthor{gmt_blue}’s (\citeyear{gmt_blue}) text \citetitle{gmt_blue} and
\citetitle{gmt_american_statistician} by
\citeauthor{gmt_american_statistician} (\citeyear{gmt_american_statistician}) were helpful when thinking over
alternative ways of proving this central theorem of econometrics.
The works that deepened our understanding of instrumental variables included
\citeauthor{Butler2016}'s (\citeyear{Butler2016}) \citetitle{Butler2016}
and \href{http://web.hku.hk/~pingyu/6005/6005.htm}{lecture notes} on Econometric theory 1 course by Ping Yu.
The first work that proves the Frisch-Waugh-Lovell theorem using pure geometry
is \citetitle{fwl} by
\citeauthor{fwl} (\citeyear{fwl}).
Finally, there were several works that apply the geometric approach to
hypothesis testing. They are
\citetitle{Langsrud2004}
by \citeauthor{Langsrud2004} (\citeyear{Langsrud2004}),
\citetitle{Siniksaran2005}
by \citeauthor{Siniksaran2005} (\citeyear{Siniksaran2005}),
and one which uses an unusual approach —
\citetitle{friendly2013}
by \citeauthor{friendly2013} (\citeyear{friendly2013}).

The paper has four parts. In the first the fundamentls of the geometry
of random variables are introduced with examples.
In part two, we develop the ideas related to linear regressions
from the ideas which need almost no assumptions to more sophisticated theorems
and concepts.
The third part is devoted to partial correlations. It contains a proof of
a newly-introduced fact about the partial correlation and the correlation
between the residuals in  alinear regression model.
Finally, probability distributions are introduced from a geometric perspective
and hypothesis tests are illustrated.

\end{fullwidth}


\section{\label{sec:selection}Computing an Execution Schedule}

Predictions of solver performance are useful only if they can be used to
execute more appropriate solvers more often. To describe the algorithm
portfolio situation in decision-theoretic terms, we take our set of past
observations---in this case, the solvers already executed on this problem
instance, and their success or failure---as our \emph{belief state}. The
Bellman equation describes the expected reward of an optimal policy, \[ V^*(s)
= R(s) + \max_a \gamma \sum_{s'}P(s' | s, a) V^*(s'), \] where $s$ is a
particular belief state, $R(s)$ describes the reward associated with a state
(here, let $1$ be the reward of any state in which any solver has been
successful, and $0$ the reward otherwise), $\gamma$ is an arbitrary discount
factor (which can be set lower to prefer quickly-obtained solutions more
strongly), $a$ is an action (the execution of some solver for some amount of
time), and $P(s'|s,a)$ is the probability of arriving in state $s'$ after
taking action $a$ in state $s$.  Since the number of possible belief states
grows quickly as actions are taken, the optimal policy is practical to compute
only if the portfolio is limited to a short action sequence.

Just such an optimal short sequence of actions was computed offline, using a
learned DCM model to define $P$; the {\tt borg-sat-10.06.07} solver then
follows that sequence when solving any new problem instance.


\section{Notation}
\label{sec:notation-shelley}

\begin{description}
  \item[$\mathbb{N}$] The (canonical) symbol for the natural numbers
  \item[$\mathbb{H}$] The type of byte strings
  \item[Aggregated Addition] Given a type
  $\type{FM}~\in~ \powerset(\type{X} \times \type{Y})$,
    where addition is defined on terms of type $\type{Y}$, and a term $\var{fm} \in \type{FM}$,
    we overload the $\sum$ notation as follows:
    \[\sum_{(x, y)\in\var{fm}} (x,y) :=
    \{ x\mapsto \sum_{(x,y)\in\var{fm}} y \} \]

    In the case $\type{Y}~=~\type{A}\mapsto\type{B}$ is itself a finite map,
    and addition is defined on terms of type $\type{B}$,
    we interpret
    \[\sum_{(x, (a\mapsto b))\in\var{fm}} (x,a\mapsto b) :=
    \{ x \mapsto (a\mapsto \sum_{(x,a\mapsto b)\in\var{fm}} b) \} \]

    We define $\sum$ on a set of the form
    \[\type{FM} \subseteq \{ x \mapsto y \vert x \in \mathsf{X}, y \in \mathsf{Y} \} \]

    in a similar way,
    \[\sum_{(x\mapsto y)\in\var{fm}} x \mapsto y :=
    \{ x\mapsto \sum_{x\mapsto y\in\var{fm}} y \} \]

    We use the $+$ to denote this overloaded addition operation also.

  \item[Other Operations] Similar to the definition of aggregated addition,
  other scalar operations are defined on finite maps. This includes multiplication,
  floor, etc.

  \item[$\leq$] This symbol is overloaded to represent the conjunction of the
  pairwise $\leq$ comparison of entries with at same index in a list or a vector.
  Every other comparison symbol is overloaded in a similar way.

\end{description}
\clearpage


%!TEX root = ../PhD_thesis__Lilian_Besson
% ******************************* Thesis Appendix B ****************************
% \chapter{About another publication: ``What Doubling-Trick Can and Can't Do for Multi-Armed Bandits''}
\chapter{About Doubling Tricks for Multi-Armed Bandits}
\label{app:2:DoublingTricks}

This appendix quickly presents the contributions of another publication that was not presented in the main text of this thesis.
We studied doubling tricks and their possible uses for multi-armed bandits, between fall 2017 and spring 2018, and we wrote an article \cite{Besson2018DoublingTricks} which was rejected at the COLT 2018 conference, and unfortunately we lacked the time to improve it and resubmit it to another conference.

% \TODOL{
% I cannot include it raw without more work on the maths, we have to write only the best versions of our results.

% But I am interested in including this article in my thesis, mainly because GLRklUCB in Chapter 6 is not anytime!

% I need to try DoublingTrick + GLRklUCB, at least experimentally!
% For the theoretical analysis, it will probably be a huge failure.
% }

\paragraph{Motivations for anytime algorithms.}
%
As introduced in Chapter~\ref{chapter:2},
an online reinforcement learning algorithm is \emph{anytime} if it does not need to know in advance the horizon $T$ of the experiment.
%
Depending on the context of the practical application of interest, it might be unrealistic to assume to know in advance $T$. We give two examples to illustrate where this prior knowledge can be realistic or not.
On the one hand, consider clinical trials: it is likely that the number of patients is known before starting the trial, and for this model we refer to all the research that studies the setting of fixed-time best-arm identification \cite{audibert2010best,Garivier16BAI}.
On the second hand, consider cognitive radio and decentralized MAB learning implemented on IoT devices (like we present it in Chapter~\ref{chapter:4}): usually a learning step corresponds to an up-link and then down-link message sent and received by the IoT device, and so the time horizon $T$ denotes the total number of such messages. While it can be assumed that the device will run for instance for $10$ years (as it is advertised by some companies \cite{Centenaro16}), many kinds of application such as medical sensors or connected fields cannot predict the number of total communications before setting up the device.

For this later range of applications, it is of highest interest to be able to use low-cost MAB algorithms that do not rely on prior knowledge of the problem for which they will be applied, and especially do not need to know the horizon $T$.
In this thesis,
while we proposed in Chapter~\ref{chapter:5} any-time algorithms solving the presented problem of stationary multi-players bandit, our solution for the problem of non-stationary MAB problem studied in Chapter~\ref{chapter:6} does rely on a prior knowledge of the horizon $T$.
It is an interesting direction of research to know what is the best approach to fix this weakness: work more and design algorithms that are inherently any-time, or use a generic technique to avoid depending on a prior knowledge of $T$, and automatically transform our non-anytime approach to make it anytime.

\paragraph{Solution to ``patch'' a non-anytime algorithm.}
%
A well-known technique to obtain an anytime algorithm from any non-anytime algorithm is the ``Doubling Trick'', as first introduced in \cite{CesaLugosi06} and used for instance in \cite{Auer10,AuerGajaneOrtner18}.
%
In the context of adversarial or stochastic multi-armed bandits,
the performance of an algorithm is measured by its regret,
and we study two families of sequences of growing horizons (geometric and exponential)
to generalize previously known results that certain doubling tricks can be used to conserve certain regret bounds.
In a broad setting, we prove that a geometric doubling trick can be used to conserve (minimax) bounds in $R_T = \cO(\sqrt{T})$ but \emph{cannot} conserve (distribution-dependent) bounds in $R_T = \cO(\log(T))$.
We give insights as to why exponential doubling tricks may be better, as they conserve bounds in $R_T = \cO(\log(T))$, and are close to conserving bounds in $R_T = \cO(\sqrt{T})$.
Interestingly, we prove that they conserve bounds of the mixed form $R_T = \cO(T^{\gamma} (\log(T))^{\delta})$, for $0<\gamma<1$ and $\delta>0$, and so an exponential doubling trick could be used to obtain an anytime version of the algorithm we propose for non-stationary bandits, \GLRklUCB{} in Chapter~\ref{chapter:6}.
However, our study was only focusing on stationary bandit, and it is left as a future work to explore the harder case of piece-wise stationary problems.

In our article \cite{Besson2018DoublingTricks}, we also present numerical experiments in the case of stationary MAB problems, to compare the performance of efficient anytime algorithms, like \klUCB, against efficient non-anytime algorithms, like \KLUCBpp{} from \cite{Menard17}, made anytime with different choices of doubling-trick.
We conclude that for such problems, if $T$ is not known before, it is always more efficient to use policies that were designed to be anytime that to use a doubling trick.
For example, an applicative paper written in 2018, \cite{li2019useDoublingTrick}, only tested the use of an exponential doubling trick combined with \KLUCBpp, but most surely the \klUCB{} algorithm would have given better empirical performance as well as more robust results\ldots

To conclude this work, we would need to complete the study of the doubling tricks, and instead of focusing on two families (geometric and exponential), we need to completely characterize the doubling tricks that allow to preserve certain regret bounds.
Such doubling is given either by the function mapping the current time $t$ to the current estimate of the horizon $T(t)$, or the sequence $(T_i)_{i\in\N^*}$ of successive estimates of the horizons.
We are interested in pursuing this work, in the hope of finding an intermediate sequence, growing faster than a geometric but slower than an exponential doubling sequence, that can preserve both worlds, problem-dependent bounds in $\cO(\log(T))$ and problem-independent bounds in $\cO(\sqrt{T})$.